本文整理汇总了PHP中iPHP::json方法的典型用法代码示例。如果您正苦于以下问题:PHP iPHP::json方法的具体用法?PHP iPHP::json怎么用?PHP iPHP::json使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iPHP
的用法示例。
在下文中一共展示了iPHP::json方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_check
function do_check()
{
if (empty($this->patch)) {
if ($_GET['ajax']) {
iPHP::json(array('code' => 0));
} else {
iPHP::success("您使用的 iCMS 版本,目前是最新版本<hr />当前版本:iCMS " . iCMS_VER . " [" . iCMS_RELEASE . "]", 0, "5");
}
} else {
switch (iCMS::$config['system']['patch']) {
case "1":
//自动下载,安装时询问
$this->msg = iPatch::download($this->patch[1]);
$json = array('code' => "1", 'url' => __ADMINCP__ . '=patch&do=install', 'msg' => "发现iCMS最新版本<br /><span class='label label-warning'>iCMS " . $this->patch[0] . " [" . $this->patch[1] . "]</span><br />" . $this->patch[3] . "<hr />您当前使用的版本<br /><span class='label label-info'>iCMS " . iCMS_VER . " [" . iCMS_RELEASE . "]</span><br /><br />新版本已经下载完成!! 是否现在更新?");
break;
case "2":
//不自动下载更新,有更新时提示
$json = array('code' => "2", 'url' => __ADMINCP__ . '=patch&do=update', 'msg' => "发现iCMS最新版本<br /><span class='label label-warning'>iCMS " . $this->patch[0] . " [" . $this->patch[1] . "]</span><br />" . $this->patch[3] . "<hr />您当前使用的版本<br /><span class='label label-info'>iCMS " . iCMS_VER . " [" . iCMS_RELEASE . "]</span><br /><br />请马上更新您的iCMS!!!");
break;
}
if ($_GET['ajax']) {
iPHP::json($json, true);
}
$moreBtn = array(array("text" => "马上更新", "url" => $json['url']), array("text" => "以后在说", "js" => 'return true'));
iPHP::dialog('success:#:check:#:' . $json['msg'], 0, 30, $moreBtn);
}
}
示例2: LoginPage
public static function LoginPage()
{
self::$AJAX && iPHP::json(array('code' => 0));
iPHP::set_cookie(self::$AUTH, '', -31536000);
include self::$LOGIN_TPL . '/template/admincp.login.php';
exit;
}
示例3: API_list
public function API_list()
{
iPHP::app('user.class', 'static');
user::get_cookie() or iPHP::code(0, 'iCMS:!login', 0, 'json');
iPHP::app('favorite.func');
$array = favorite_list(array('userid' => user::$userid));
iPHP::json($array);
}
示例4: API_json
public function API_json()
{
$vars = array('appid' => iCMS_APP_ARTICLE, 'id' => (int) $_GET['id'], 'iid' => (int) $_GET['iid'], 'date_format' => 'Y-m-d H:i');
$_GET['by'] && ($vars['by'] = iS::escapeStr($_GET['by']));
$_GET['date_format'] && ($vars['date_format'] = iS::escapeStr($_GET['date_format']));
$vars['page'] = true;
iPHP::app('comment.func', 'static');
$array = comment_list($vars);
iPHP::json($array);
//iPHP::assign('vars',$vars);
//iPHP::view('iCMS://comment/api.json.htm');
}
示例5: LoginPage
function LoginPage()
{
self::$ajax && iPHP::json(array('code' => 0));
iPHP::set_cookie(self::$AUTH, '', -31536000);
include self::$LOGIN_TPL . '/template/login.php';
exit;
}
示例6: API_data
public function API_data($uid = 0)
{
$user = user::status();
if ($user) {
$array = array('code' => 1, 'uid' => $user->uid, 'url' => $user->url, 'avatar' => $user->avatar, 'nickname' => $user->nickname);
iPHP::json($array);
} else {
user::logout();
iPHP::code(0, 0, $this->forward, 'json');
}
}
示例7: do_uploadscrawl
function do_uploadscrawl()
{
if ($_GET["action"] == "tmpImg") {
// 背景上传
iFS::$callback = false;
$F = iFS::upload('upfile', 'scrawl/tmp');
$F === false && exit;
$F['path'] && ($url = iFS::fp($F['path'], '+http'));
echo "<script>parent.ue_callback('" . $url . "','SUCCESS')</script>";
} else {
iFS::$callback = true;
$F = iFS::base64ToFile($_POST['upfile'], 'scrawl/' . get_date(0, 'Y/md'));
$F === false && exit(iFS::$ERROR);
$F['path'] && ($url = iFS::fp($F['path'], '+http'));
$tmp = iFS::get_dir() . "scrawl/tmp/";
iFS::rmdir($tmp);
iPHP::json(array("url" => $url, "state" => 'SUCCESS'));
}
}
示例8: do_getmeta
function do_getmeta()
{
$cid = $_GET['cid'];
$cid && ($contentprop = unserialize($this->category[$cid]['contentprop']));
iPHP::json($contentprop);
}
示例9: do_delfile
function do_delfile()
{
iACP::MP('FILE.DELETE', 'alert');
$_GET['path'] or iPHP::alert("请选择要删除的文件");
strpos($_GET['path'], '..') !== false && iPHP::alert("文件路径中带有..");
$hash = md5($_GET['path']);
$FileRootPath = iFS::fp($_GET['path'], '+iPATH');
if (iFS::del($FileRootPath)) {
$msg = 'success:#:check:#:文件删除完成!';
$_GET['ajax'] && iPHP::json(array('code' => 1, 'msg' => $msg));
} else {
$msg = 'warning:#:warning:#:找不到相关文件,文件删除失败!';
$_GET['ajax'] && iPHP::json(array('code' => 0, 'msg' => $msg));
}
iPHP::dialog($msg, 'js:parent.$("#' . $hash . '").remove();');
}