Слияние кода завершено, страница обновится автоматически
<?php
require_once ("site_jyconfig.php");
require_once ("JYNET.php");
define(APIPATH,"http://api.91160.com/");
define(UPLOADPATH,"http://api.91160.com/upload/");
define(UPLOADTMP,"tmp/");
/***使用方式****
*
* 直接生成类
* $obj = new JYAPI("Model_Unit",true);
*
* 调用类的方法
* $obj->getUnidList(0,1,2);
*
* 取值
* $pager = $obj->pager;
*
* 设值
* $obj->newUnit(xxxx);
*
* 调试
* var_dump( $a->debug() );
****/
/***使用方式2 - 文件上传****
*
* 直接生成类
* $obj = new JYAPI("File");
*
* 调用send方法并返回临时文件名
* $file_tmp_name = $obj->send("文件.doc");
*
****/
/**
* 子站使用的就医API
* @author jake
* @version 1.0
* @created 09-三月-2009 9:30:40
*/
class JYAPI
{
/**
* 类版本
*/
var $__version = 1;
/**
* 网络类的实例
*/
var $__objNet = null;
/**
* 配置文件地址
*/
var $__configFile = "JYConfig.php";
/**
* 是否是传送文件
*/
var $__isFile = false;
/**
* 配置参数
*/
var $__configParams = array();
/**
* 执行的类名
*/
var $__remoteClass = null;
/**
* 构造函数,生成类
*/
public function __construct($remoteClass,$setPersistent = false){
if( "File" == $remoteClass )$this->__isFile = TRUE;
if( !is_readable ( PHP168_PATH.$this->__configFile ) ){
$this->__Error( "无法读取配置文件,请确认JYConfig.php文件的位置并设置其可读。" );
}else{
$__configParams = require(PHP168_PATH.$this->__configFile);
}
// 实例化网络对象
$this->__objNet = new JYNET($remoteClass, $__configParams, $setPersistent);
if( false == $this->__objNet ){
$this->__Error( "无法创建网络对象,请检查网络链接。" );
}
// 记录当前需要的类名称
$this->__remoteClass = $remoteClass;
}
/**
* 执行类的方法
*/
function __call( $name, $args ) {
if( "debug" != $name ){
if( $this->__isFile == TRUE ){
return $this->__objNet->sendFile( $args[0] );
}else{
return $this->__objNet->sendCommand( $this->__remoteClass, $name, $args );
}
}
}
/**
* 取值
*/
function __set( $name, $value ) {
return $this->__objNet->sendCommand( $this->__remoteClass, "SET", array( $name => $value ) );
}
/**
* 设值
*/
function __get( $name ) {
return $this->__objNet->sendCommand( $this->__remoteClass, "GET", array( 0 => $name ) );
}
/**
* 显示一直以来的返回字符串
*/
function __toString(){
return __CLASS__ . " version:" . $this->__version;
}
/**
* 显示一直以来的返回字符串
*/
function debug(){
return $this->__objNet->getNetInfo();
}
function dump(){
return dump( $this->__objNet->getDump() );
}
/**
* 错误提示
*/
function __Error( $msg ){
die("JYAPI ERROR: " . $msg);
}
}
/**
* 输出变量的内容,通常用于调试
*
* @package Core
*
* @param mixed $vars 要输出的变量
* @param string $label
* @param boolean $return
*/
function dump($vars, $label = '', $return = false)
{
if (ini_get('html_errors')) {
$content = "<pre>\n";
if ($label != '') {
$content .= "<strong>{$label} :</strong>\n";
}
$content .= htmlspecialchars(print_r($vars, true));
$content .= "\n</pre>\n";
} else {
$content = $label . " :\n" . print_r($vars, true);
}
if ($return) { return $content; }
echo $content;
return null;
}
/**
* 分页显示
*
* @package Core
*
* @param mixed $vars 要输出的变量
* @param string $label
* @param boolean $return
*/
function jy_api_pager2( $url, $pager ){
$params = array(
"url" => $url,
"pager" => $pager,
"sep" => "|num|",
"style" => "s_pager"
);
return jy_api_pager($params);
}
function jy_api_pager($params)
{
/****
$url = "kk.php?p=|num|"
$sep = "|num|";
$style = "s_pager";
$pager = Array
(
[pageSize] => 2
[totalCount] => 3
[count] => 3
[pageCount] => 2
[firstPage] => 1
[firstPageNumber] => 1
[lastPage] => 2
[lastPageNumber] => 2
[prevPage] => 1
[prevPageNumber] => 1
[nextPage] => 2
[nextPageNumber] => 2
[currentPage] => 1
[currentPageNumber] => 1
[pagesNumber] => Array
(
[0] => 1
[1] => 2
)
)
****/
extract($params);
$jump_num = 5;
if( isset($pager) && $pager["pageCount"] > 1 ){
// $sep = urlencode($sep);
$out = "<div id='$style'>共有<font color=\"#FF0000\">".$pager["totalCount"]."</font>条记录 ";
$out .= "总共<font color=\"#000099\">".$pager["pageCount"]."</font>页 ";
$out .= "<font color=\"#FF0000\">".$pager["pageSize"]."</font>条/页 ";
$out .= "<a href='".str_replace($sep, $pager["firstPageNumber"], $url)."'>首页</a> | ";
$out .= "<a href='".str_replace($sep, $pager["prevPageNumber"], $url)."'>上一页</a> | ";
$out .= "<a href='".str_replace($sep, $pager["nextPageNumber"], $url)."'>下一页</a> | ";
$out .= "<a href='".str_replace($sep, $pager["lastPageNumber"], $url)."'>末页</a> ";
foreach( $pager["pagesNumber"] as $value ){
if( $value > ( $pager["currentPageNumber"] + $jump_num ) || $value < ( $pager["currentPageNumber"] - $jump_num ) ){
}else{
if( $value == $pager["currentPageNumber"] ){
$out .= "<font color=\"#FF0000\">$value</font> ";
}else{
$out .= "<a href='".str_replace($sep, $value, $url)."'>$value</a> ";
}
}
}
$out .= "跳到<input name=\"jump\" type=\"text\" size=\"4\" onkeypress=\"if(event.keyCode==13){Javascript:location.href='".str_replace($sep, "'+this.value+'", $url)."';}\" />页</div>";
return $out;
}
}
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )