首页
您所在的位置:首页 > 天天一笑笑 > 正文

zaiykcns

作者:冷笑话 来源: 日期:2020/10/31 17:56:13 人气:0 加入收藏 标签:

<?php

/**

 * diy.seowhy.com 小程序接口文档

 * 仅支持 php 5.3 以上

 * 版权保护,如需使用,请访问 https://diy.seowhy.com。

 * @author seowhy

 * 微信:seowhy07

 * 电话:189028466619

 * 需要目录权限:appimage,appdata

 */


 if (!empty($_GET['debug'])) { ini_set("display_errors", 1); error_reporting(E_ALL & ~E_NOTICE); } else { ini_set("display_errors", 0); error_reporting(0); } if (version_compare(PHP_VERSION, '5.3.0', '<')) { showMessage('当前PHP版本为'.phpversion().',小于5.3,请升级php版本5.3以上', 1003); } if (!class_exists('PDO', false)) { showMessage("空间不支持pdo连接", 1003); } $_GET['a'] = parseAction($_GET['a']); $from = $_GET['from']; if ($from != 'x') { showMessage("接口文件工作正常"); } define('APP_ID', '1349');define('TOKEN', 'zaiykcnsizdxlbxbaighmagwzmtidrkvkehqfiszpfmmlxjyrwturxvgubougzmx');define('VERSION', '1.0.1'); define('APP_PATH', __DIR__ . '/'); define('DATA_PATH', APP_PATH.'seowhy-neves/'); define('BACKAPI', 'https://diy.seowhy.com/api/'); $checkToken = $_GET['token']; $checkTime = $_GET['_t']; $check = $_GET['check']; $action = $_GET['a']; if (md5(APP_ID . TOKEN . $checkTime) != $checkToken && !$check && !in_array($action, array( 'config', 'sitemap', 'mapping', ))) { res(1001, "访问受限"); } $client = new appClient(); $client->run(); class appClient { private static $errmap = array( '0' => '错误要了命了  ', '1' => '致命运行时错误', '2' => '运行时警告    ', '4' => '编译语法错误  ', '8' => '运行时通知    ', '16' => '初始化致命错误', '32' => '初始化警告    ', '64' => '致命编译错误  ', '128'=> '编译时警告    ', '256'=> '用户自定义错误', '512'=> '用户自定义警告', '1024'=> '用户自定义通知', '2048'=> 'PHP兼容性建议 ', '4096'=> '可捕捉致命错误', '8192'=> '运行时通知    ', '16384'=>'用户产生的警告', '30719'=>'其他警告WARNING' ); private $configPath; private $config = array(); public function __construct() { @set_error_handler(array(&$this, 'error_handler'), E_ALL & ~E_NOTICE & ~E_WARNING); @set_exception_handler(array(&$this, 'exception_handler')); $this->configPath = DATA_PATH . 'appclient.config.php'; if (!file_exists($this->configPath)) { $this->checkProvider(); } else { $this->config = include($this->configPath); if (empty($this->config['checked'])) { $this->checkConfig(); } } } public function error_handler($type, $message, $file, $line) { $msg = $message.' '.$file.' '.$line; self::whetherOut($msg, $type); } public function exception_handler($error) { $msg = $error->getMessage().' '.$error->getFile().' '.$error->getLine().' '; self::whetherOut($msg, $error->getCode()); } private static function whetherOut($str,$type=30719){ if (intval($type) <= 30719) { res(-1, $str); } } public function run() { $action = $_GET['a']; if (in_array($action, array('upgrade', 'config'))) { $this->{$action}(); } if (empty($this->config['checked'])) { res(1002, "接口配置异常,无法正常读取配置信息"); } else { $appAction = new appAction($this->config); $appAction->handle(); } } private function checkProvider() { $provider = ''; if (file_exists(APP_PATH . 'index.php')) { $content = file_get_contents(APP_PATH . 'index.php'); if (strpos($content, 'DEDEINC') !== false) { $provider = 'dedecms'; } elseif (strpos($content, 'WordPress') !== false) { $provider = 'wordpress'; } elseif (strpos($content, 'PHPCMS') !== false) { $provider = 'phpcms'; } elseif (strpos($content, 'Zend') !== false) { if (file_exists(APP_PATH . 'click_cnt.php')) { $provider = 'nitc'; } } elseif ( strpos($content,'Filter_Plugin_Index_Begin') !== false ){ $provider = 'zblog'; } } elseif (file_exists(APP_PATH . 'd/') && file_exists(APP_PATH . 'e/')) { $provider = 'empire'; } elseif (file_exists(APP_PATH . 'plus/')) { $provider = 'dedecms'; } elseif (file_exists(APP_PATH.'zb_users/')) { $provider = 'zblog'; } elseif( file_exists(APP_PATH.'caches/configs') ) { $provider = 'phpcms'; } if ($provider) { $this->config['provider'] = $provider; } $this->checkConfig(); } private function config() { if (!is_array($this->config)) { $this->config = array(); } $config = json_decode(file_get_contents("php://input"), true); if (empty($config)) { $config = array(); } foreach ($config as $key => $item) { if (is_array($item)) { if (!is_array($this->config[$key])) { $this->config[$key] = array(); } foreach ($item as $k => $v) { $this->config[$key][$k] = $v; } } else { $this->config[$key] = $item; } } $this->checkConfig(); if (empty($this->config['checked'])) { res(1002, "配置失败,无法正常连接数据库"); } res(0, "配置成功", $this->config); } private function upgrade() { global $checkToken, $checkTime; $url = BACKAPI . "upgrade"; $clientContent = request($url, 'GET', array('version' => VERSION, 'app_id' => APP_ID, 'token' => $checkToken, '_t' => $checkTime, 'file' => 'appclient')); if (strpos($clientContent, "<?php") === 0) { $fileName = basename($_SERVER['PHP_SELF']); $result = file_put_contents(APP_PATH . $fileName, $clientContent); if (!$result) { res(-1, "更新失败a" . $fileName); } } else { res(-1, "更新失败a" . $clientContent); } $url = BACKAPI . "upgrade"; $clientContent = request($url, 'GET', array('version' => VERSION, 'app_id' => APP_ID, 'token' => $checkToken, '_t' => $checkTime, 'file' => $this->config['provider'])); if (strpos($clientContent, "<?php") === 0) { $result = file_put_contents(APP_PATH . $this->config['provider'] . '.php', $clientContent); if (!$result) { res(-1, "更新失败," . $this->config['provider'] . '.php'); } } else { res(-1, "更新失败," . $clientContent); } res(0, "更新成功"); } private function checkConfig() { global $checkToken, $checkTime; if (!$this->config['setting']) { $this->config['setting'] = array(); } if (!$this->config['setting']['base_url']) { $this->config['setting']['base_url'] = baseUrl(); } else { $this->config['setting']['base_url'] = rtrim($this->config['setting']['base_url'], "/") . "/"; } if ($this->config['provider']) { $providerFile = DATA_PATH . $this->config['provider'] . ".php"; if (!file_exists($providerFile)) { mkdir ( DATA_PATH, 0777, true ); $url = BACKAPI . "upgrade"; $clientContent = request($url, 'GET', array('version' => VERSION, 'app_id' => APP_ID, 'token' => $checkToken, '_t' => $checkTime, 'file' => $this->config['provider'])); if (strpos($clientContent, "<?php") === 0) { $result = file_put_contents(DATA_PATH . $this->config['provider'] . '.php', $clientContent); if (!$result) { res(-1, "更新provider失败"); } } else { res(-1, "更新provider失败"); } } require_once $providerFile; } switch ($this->config['provider']) { case 'dedecms': $this->checkDedecms(); break; case 'phpcms': $this->checkPhpcms(); break; case 'wordpress': $this->checkWordpress(); break; case 'empire': $this->checkEmpire(); break; case 'nitc': $this->checkNitc(); break; case 'zblog': $this->checkZblog(); break; default: $this->config = array(); break; } $this->writeConfig(); } private function checkDedecms() { if (empty($this->config['database'])) { $configFile = APP_PATH . "data/common.inc.php"; if (!file_exists($configFile)) { $dir_handle = opendir(APP_PATH); while (($file = readdir($dir_handle)) !== false) { if (substr($file, 0, 1) !== '.' and is_dir(APP_PATH . $file)) { $dir_handle2 = opendir(APP_PATH . $file); while (($file2 = readdir($dir_handle2)) !== false) { if ($file2 === 'common.inc.php') { $filePath = APP_PATH . $file . '/' . $file2; $content = file_get_contents($filePath); if (strpos($content, '//数据库连接信息') !== false) { $configFile = $filePath; break 2; } } } closedir($dir_handle2); } } closedir($dir_handle); } if (!file_exists($configFile)) { res(1002, "接口配置异常,无法正常读取配置信息"); } $cfg_dbhost = $cfg_dbuser = $cfg_dbpwd = $cfg_dbname = $cfg_db_language = $cfg_dbprefix = ''; require_once($configFile); $hostArr = explode(":", $cfg_dbhost); $this->config['database'] = array( 'host' => $hostArr[0], 'port' => $hostArr[1] ? $hostArr[1] : '3306', 'user' => $cfg_dbuser, 'password' => $cfg_dbpwd, 'database' => $cfg_dbname, 'charset' => $cfg_db_language, 'prefix' => $cfg_dbprefix ); } if (!$this->config['setting']['product_model_id']) { $this->config['setting']['product_model_id'] = 6; } $provider = new dedecmsProvider($this->config); $this->config['checked'] = $provider->checkConfig(); } private function checkPhpcms() { $configFile = APP_PATH . "caches/configs/database.php"; if (!file_exists($configFile)) { res(1002, "接口配置异常,无法正常读取配置信息"); } $fileConfig = include($configFile); $this->config['database'] = array( 'host' => $fileConfig['default']['hostname'], 'port' => $fileConfig['default']['port'], 'user' => $fileConfig['default']['username'], 'password' => $fileConfig['default']['password'], 'database' => $fileConfig['default']['database'], 'charset' => $fileConfig['default']['charset'], 'prefix' => $fileConfig['default']['tablepre'] ); if (!$this->config['setting']['site_id']) { $this->config['setting']['site_id'] = 1; } $provider = new phpcmsProvider($this->config); $this->config['checked'] = $provider->checkConfig(); if( $this->config['setting']['product_model_id'] ) { $productTableName = $provider->getProductTableName(); if (!$productTableName) { res(1002, "产品表不存在"); } $this->config['database']['productTableName'] = $productTableName; } } private function checkWordpress() { if (empty($this->config['database'])) { $configFile = APP_PATH . "wp-config.php"; if (!file_exists($configFile)) { res(1002, "接口配置异常,无法正常读取配置信息"); } $table_prefix = ''; $contents = file_get_contents($configFile); preg_match('/\$table_prefix\s*=\s*[\'|"](.+)[\'|"]/', $contents, $match); $table_prefix = $match[1]; preg_match('/define\(\s*[\'|"]DB_NAME[\'|"],\s*[\'|"](.+)[\'|"]/', $contents, $match); $dbName = $match[1]; preg_match('/define\(\s*[\'|"]DB_USER[\'|"],\s*[\'|"](.+)[\'|"]/', $contents, $match); $dbUser = $match[1]; preg_match('/define\(\s*[\'|"]DB_PASSWORD[\'|"],\s*[\'|"](.+)[\'|"]/', $contents, $match); $dbPassword = $match[1]; preg_match('/define\(\s*[\'|"]DB_HOST[\'|"],\s*[\'|"](.+)[\'|"]/', $contents, $match); $dbHost = $match[1]; preg_match('/define\(\s*[\'|"]DB_CHARSET[\'|"],\s*[\'|"](.+)[\'|"]/', $contents, $match); $dbCharset = $match[1]; $hostArr = explode(":", $dbHost); $this->config['database'] = array( 'host' => $hostArr[0], 'port' => empty($hostArr[1]) ? '3306' : $hostArr[1], 'user' => $dbUser, 'password' => $dbPassword, 'database' => $dbName, 'charset' => $dbCharset, 'prefix' => $table_prefix ); } $provider = new wordpressProvider($this->config); $this->config['checked'] = $provider->checkConfig(); } private function checkEmpire() { if (empty($this->config['database'])) { define('InEmpireCMS', true); $configFile = APP_PATH . "e/config/config.php"; if (!file_exists($configFile)) { res(1002, "接口配置异常,无法正常读取配置信息"); } $ecms_config = array(); require_once($configFile); $this->config['database'] = array( 'host' => $ecms_config['db']['dbserver'], 'port' => $ecms_config['db']['dbport'] ? $ecms_config['db']['dbport'] : '3306', 'user' => $ecms_config['db']['dbusername'], 'password' => $ecms_config['db']['dbpassword'], 'database' => $ecms_config['db']['dbname'], 'charset' => $ecms_config['db']['dbchar'], 'prefix' => $ecms_config['db']['dbtbpre'] ); } if (!$this->config['setting']['product_model_id']) { $this->config['setting']['product_model_id'] = 5; } if (!$this->config['setting']['article_model_id']) { $this->config['setting']['article_model_id'] = 1; } $provider = new empireProvider($this->config); $this->config['checked'] = $provider->checkConfig(); } private function checkNitc() { $configFile = APP_PATH . "config.php"; if (!file_exists($configFile)) { res(1002, "接口配置异常,无法正常读取配置信息"); } $db_host = $db_user = $db_pass = $db_name = $prefix = ''; require_once($configFile); $hostArr = explode(":", $db_host); $config = array( "provider" => 'wordpress', "database" => array( 'host' => $hostArr[0], 'port' => $hostArr[1], 'user' => $db_user, 'password' => $db_pass, 'database' => $db_name, 'charset' => 'utf8', 'prefix' => $prefix ), ); return $config; } private function checkZblog(){ if (empty($this->config['database'])) { $configFile = APP_PATH . "zb_users/c_option.php"; if (!file_exists($configFile)) { res(1002, "接口配置异常,无法正常读取配置信息"); } $fileConfig = include($configFile); $this->config['database'] = array( 'host' => $fileConfig['ZC_MYSQL_SERVER'], 'port' => $fileConfig['ZC_MYSQL_PORT'], 'user' => $fileConfig['ZC_MYSQL_USERNAME'], 'password' => $fileConfig['ZC_MYSQL_PASSWORD'], 'database' => $fileConfig['ZC_MYSQL_NAME'], 'charset' => $fileConfig['ZC_MYSQL_CHARSET'], 'prefix' => $fileConfig['ZC_MYSQL_PRE'] ); } $provider = new zblogProvider($this->config); $this->config['checked'] = $provider->checkConfig(); } private function writeConfig() { $configString = "<?php\n\n//appclient配置文件\nreturn " . var_export($this->config, true) . ";\n"; if( !is_dir(DATA_PATH) ) { mkdir(DATA_PATH,0777,true); } $result = file_put_contents($this->configPath, $configString); if (!$result) { res(1002, "无法写入配置,目录权限不足"); } } } class appAction { protected $categoryFields = array( 'id' => '', 'title' => '', 'content' => '', 'parent_id' => '', 'seo_title' => '', 'keywords' => '', 'description' => '', 'status' => '', 'sort' => '', 'logo' => '', 'views' => '', 'slug' => '', 'model' => '', 'add_time' => '', ); protected $articleFields = array( 'id' => '', 'title' => '', 'content' => '', 'seo_title' => '', 'keywords' => '', 'description' => '', 'status' => '', 'sort' => '', 'logo' => '', 'views' => '', 'category_id' => '', 'slug' => '', 'author' => '', 'model' => '', 'params' => array(), 'add_time' => '', ); protected $productFields = array( 'id' => '', 'title' => '', 'content' => '', 'seo_title' => '', 'keywords' => '', 'description' => '', 'status' => '', 'sort' => '', 'logo' => '', 'views' => '', 'category_id' => '', 'slug' => '', 'price' => '', 'origin' => '', 'author' => '', 'model' => '', 'params' => array(), 'add_time' => '', ); protected $pageFields = array( 'id' => '', 'title' => '', 'content' => '', 'seo_title' => '', 'keywords' => '', 'description' => '', 'status' => '', 'sort' => '', 'logo' => '', 'views' => '', 'category_id' => '', 'slug' => '', 'author' => '', 'model' => '', 'params' => array(), 'add_time' => '', ); protected $commentFields = array( 'id' => '', 'model' => '', 'source_id' => '', 'content' => '', 'uid' => 0, 'user_name' => '', 'status' => '', 'add_time' => '', 'quote_id' => 0, 'to_uid' => 0, 'agree_count' => 0, ); public $provider; public $config; public $pageConfig; public $data; public $pageSize = 20; private $dataDir; public function __construct($config) { global $checkToken, $checkTime; $providerFile = DATA_PATH . $config['provider'] . ".php"; if (!file_exists($providerFile)) { $url = BACKAPI . "upgrade"; $clientContent = request($url, 'GET', array('version' => VERSION, 'app_id' => APP_ID, 'token' => $checkToken, '_t' => $checkTime, 'file' => $config['provider'])); if (strpos($clientContent, "<?php") === 0) { $result = file_put_contents($providerFile, $clientContent); if (!$result) { res(-1, "配置错误,对应的provider不存在,接口无法更新provider"); } } else { res(-1, '配置错误,对应的provider不存在,并且更新provider失败'); } } require $providerFile; $this->config = $config; $providerName = $config['provider'] . 'Provider'; $this->provider = new $providerName($config); $this->dataDir = DATA_PATH . "appdata/"; if (!file_exists($this->dataDir)) { mkdir($this->dataDir); } } public function handle() { $funcName = $_GET['a'] . "Action"; if (method_exists($this, $funcName)) { $this->{$funcName}(); } else { res(-1, '错误的入口'); } } public function indexAction() { $this->_pageConfig(array()); res(0, null, $this->data); } public function categoryListAction() { $page = intval($_GET['page']); $row = intval($_GET['row']); $categoryId = $_GET['cat_id']; $model = $_GET['model'] ? $_GET['model'] : 'article'; $backend = $_GET['backend']; $child = $_GET['child']; $parent_id = intval($_GET['parent_id']); if ($page < 1) { $page = 1; } if ($row < 2) { $row = $this->pageSize; } $row = 9999; $args = array( 'category_id' => $categoryId, 'model' => $model, 'page' => $page, 'row' => $row, 'backend' => $backend, 'child' => $child, 'parent_id' => $parent_id, ); $result = $this->provider->getCategories($args); if ($backend) { $defaultCategories = array( array( 'spacer' => '', 'id' => 'new', 'parent_id' => 0, 'title' => "最新" ), array( 'spacer' => '', 'id' => 'hot', 'parent_id' => 0, 'title' => "热门" ), ); $result = array_merge($defaultCategories, $result); } res(0, null, $result); } public function categoryDetailAction() { $id = intval($_GET['id']); $category = $this->provider->getCategory(array('id' => $id, 'child' => $_GET['child'])); $this->data['category'] = $category; $this->_pageConfig($category); res(0, null, $this->data); } public function listAction($model = null) { $categoryId = intval($_GET['cat_id']); $page = intval($_GET['page']); $row = intval($_GET['row']); $model = $model ? $model : $_GET['model']; $q = $_GET['q']; $ids = $_GET['ids']; if ($page < 1) { $page = 1; } if ($row < 2) { $row = $this->pageSize; } if ($categoryId) { $category = $this->provider->getCategory(array('id' => $categoryId)); if (!$category) { res(-1, '分类内容不存在'); } } $args = array( 'category_id' => $categoryId, 'page' => $page, 'row' => $row, 'ids' => $ids, 'keyword' => $q, ); if ($category['model'] == 'product' || $model == 'product') { $args['model'] = "product"; } else { $args['model'] = "article"; } $result = $this->provider->getPosts($args); $result['total'] = intval($result['total']); $hasNext = $page * $row < $result['total'] ? true : false; res(0, null, $result['data'], array( 'total' => intval($result['total']), 'has_next' => $hasNext, )); } public function postsAction() { res(0, null, $this->data); } public function articleListAction() { $this->listAction('article'); } public function commentListAction() { $model = $_GET['model']; $sourceId = intval($_GET['source_id']); $page = intval($_GET['page']); $row = intval($_GET['row']); $category_id = intval($_GET['category_id']); if ($page < 1) { $page = 1; } if ($row < 2) { $row = $this->pageSize; } $args = array( 'model' => $model, 'source_id' => $sourceId, 'page' => $page, 'row' => $row, 'category_id' => $category_id, ); $result = $this->provider->getComments($args); $result['total'] = intval($result['total']); $hasNext = $page * $row < $result['total'] ? true : false; return res(0, null, $result['data'], array( 'total' => $result['total'], 'has_next' => $hasNext, )); } public function commentSaveAction() { $data = json_decode(file_get_contents("php://input"), true); $data['ip'] = getClientIp(); $result = $this->provider->saveComment($data); $url = BACKAPI . "comment/saveBack?" . http_build_query($_GET); request($url, 'POST', json_encode($data)); res($result['code'], $result['msg']); } public function commentAttitudeAction() { $data = json_decode(file_get_contents("php://input"), true); $result = $this->provider->commentAttitude($data); res($result['code'], $result['msg']); } public function articleDetailAction() { $id = intval($_GET['id']); $article = $this->provider->getArticle(array('id' => $id)); $article['content'] = str_replace('&middot;', '·', $article['content']); $this->data['article'] = $article; $this->_pageConfig($article); res(0, null, $this->data); } public function productListAction() { $this->listAction('product'); } public function productDetailAction() { $id = intval($_GET['id']); $product = $this->provider->getProduct(array('id' => $id)); $product['content'] = str_replace('&middot;', '·', $product['content']); if (!$product) { res(-1, '产品不存在'); } $this->data['product'] = $product; $this->_pageConfig($product); res(0, null, $this->data); } public function pageListAction() { $categoryId = intval($_GET['cat_id']); $page = intval($_GET['page']); $row = intval($_GET['row']); $q = $_GET['q']; $ids = $_GET['ids']; if ($page < 1) { $page = 1; } if ($row < 2) { $row = $this->pageSize; } if ($categoryId) { $category = $this->provider->getCategory(array('id' => $categoryId)); if (!$category) { res(-1, '分类内容不存在'); } } $args = array( 'category_id' => $categoryId, 'page' => $page, 'row' => $row, 'ids' => $ids, 'keyword' => $q, ); $result = $this->provider->getPages($args); $result['total'] = intval($result['total']); $hasNext = $page * $row < $result['total'] ? true : false; res(0, null, $result['data'], array( 'total' => $result['total'], 'has_next' => $hasNext, )); } public function pageDetailAction() { $id = intval($_GET['id']); $article = $this->provider->getPage(array('id' => $id)); $this->data['page'] = $article; $this->_pageConfig($article); res(0, null, $this->data); } public function paramsAction() { $model = $_GET['model'] ? $_GET['model'] : 'article'; $args = array( 'model' => $model, ); $result = $this->provider->getParams($args); res(0, null, $result); } public function defaultAction() { res(0, null, $this->data); } public function featureDetailAction() { $id = $_GET['id']; $type = $_GET['type']; $sourceId = $_GET['source_id']; $categoryId = $_GET['category_id']; if($type == 'page'){ $type = 'article'; } if ($categoryId && empty($type)) { $category = $this->provider->getCategory(array("id" => $categoryId)); $type = $category["model"] . "Category"; } if ($sourceId && $type) { $designPath = $this->dataDir . $type . "_" . $sourceId . ".json"; if (!file_exists($designPath)) { $designPath = $this->dataDir . ($id ? $id : $type) . ".json"; } } else { $designPath = $this->dataDir . ($id ? $id : $type) . ".json"; } if (!file_exists($designPath)) { $url = BACKAPI . "feature/detail?" . http_build_query($_GET); $clientContent = request($url); if (!$clientContent) { res(-1, "页面不存在"); } $result = json_decode($clientContent, true); $this->saveDataAction(array( 'pageName' => $type, 'sourceId' => $sourceId, 'id' => $id, 'content' => json_encode($result['data']), )); die($clientContent); } $content = file_get_contents($designPath); if ($content) { $design = json_decode($content, true); if ($design['page'] == 'home') { } res(0, null, $design); } else { res(-1, "页面不存在"); } } public function settingSystemAction() { $designPath = $this->dataDir . "global.json"; $do_action = $_GET['do_action']; if (!file_exists($designPath) || $do_action == 'update') { $url = BACKAPI . "setting/system?" . http_build_query($_GET); $clientContent = request($url); if (!$clientContent) { res(-1, "配置不存在"); } $result = json_decode($clientContent, true); $this->saveDataAction(array( 'pageName' => 'global', 'sourceId' => null, 'id' => null, 'content' => json_encode($result['data']), )); die($clientContent); } $content = file_get_contents($designPath); if ($content) { $setting = json_decode($content, true); res(0, null, $setting); } else { res(-1, "页面不存在"); } } public function settingCopyrightAction() { $designPath = $this->dataDir . "copyright.json"; $content = file_get_contents($designPath); if (!file_exists($designPath)) { res(0, null, array('content' => '')); } if ($content) { $setting = json_decode($content, true); res(0, null, $setting); } else { res(0, null, array('content' => '')); } } public function settingFeedbackSaveAction() { $url = BACKAPI . "setting/feedback/save?" . http_build_query($_GET); $clientContent = request($url, 'POST', file_get_contents("php://input")); if (!$clientContent) { res(-1, "留言保存失败"); } $result = json_decode($clientContent, true); res($result['code'], $result['msg']); } public function feedbackFieldsAction() { $designPath = $this->dataDir . "feedback.json"; $content = file_get_contents($designPath); if (!file_exists($designPath)) { $url = BACKAPI . "feedback/fields?" . http_build_query($_GET); $clientContent = request($url); if (!$clientContent) { res(-1, "表单不存在"); } $result = json_decode($clientContent, true); $this->saveDataAction(array( 'pageName' => 'feedback', 'sourceId' => null, 'id' => null, 'content' => json_encode($result['data']), )); die($clientContent); } if ($content) { $setting = json_decode($content, true); res(0, null, $setting); } else { res(-1, "表单不存在"); } } public function feedbackSaveAction() { $url = BACKAPI . "feedback/save?" . http_build_query($_GET); $clientContent = request($url, 'POST', file_get_contents("php://input")); if (!$clientContent) { res(-1, "留言保存失败"); } $result = json_decode($clientContent, true); res($result['code'], $result['msg']); } public function uploadAction() { $fileName = $_GET['file_name']; $savePath = DATA_PATH . "appimage/" . $fileName; if (in_array(pathinfo($fileName, PATHINFO_EXTENSION), array('jpeg', 'jpg', 'png', 'gif'))) { $file = reset($_FILES); $fileDir = dirname($savePath); if (!file_exists($fileDir)) { mkdir($fileDir, 0777, true); } move_uploaded_file($file['tmp_name'], $savePath); res(0, '图片保存成功'); } else { res(-1, '不支持的图片'); } } public function saveDataAction($saveData = null) { $return = false; if ($saveData['pageName'] || $saveData['content']) { $pageName = $saveData['pageName']; $id = $saveData['id']; $sourceId = $saveData['sourceId']; $content = $saveData['content']; $return = true; }else { $pageName = $_GET['page_name']; $id = $_GET['id']; $sourceId = $_GET['source_id']; $content = file_get_contents("php://input"); } $savePaths = array(); if ($pageName) { $savePaths[] = $this->dataDir . $pageName . ".json"; } if ($sourceId) { $savePaths[] = $this->dataDir . $pageName . "_" . $sourceId . ".json"; } if ($id) { $savePaths[] = $this->dataDir . $id . ".json"; } foreach ($savePaths as $val) { $result = file_put_contents($val, $content); if (!$result) { if($return){ return false; } res(-1, '文件写入失败'); } } if($return){ return true; } res(0, "文件保存成功"); } public function sitemapAction() { if( $_GET['appType'] == 'toutiao' ) { $this->siteMapXmlToutiao(); }else{ $this->siteMapCommon(); } } private function siteMapCommon() { $sudDay = $_GET['sudDay']; $sitemap = array("pages/index/index", "pages/productIndex/index", "pages/articleIndex/index"); $products = $this->provider->getProducts(array('sudDay' => $sudDay,'row'=>100000)); foreach ($products['data'] as $item) { $sitemap[] = "pages/product/index?id=" . $item['id']; } $articles = $this->provider->getArticles(array('sudDay' => $sudDay,'row'=>100000)); foreach ($articles['data'] as $item) { $sitemap[] = "pages/article/index?id=" . $item['id']; } $categories = $this->provider->getCategories(); foreach ($categories as $item) { $sitemap[] = "pages/category/index?id=" . $item['id']; } $content = implode("\r\n", $sitemap); header("content-Type: text/html; charset=UTF-8"); header("Content-type:text/plan"); header("Accept-Ranges: bytes"); header("Accept-Length: " . strlen($content)); header("Content-Disposition: attachment; filename=siteMap.txt"); die($content); } private function siteMapXmlToutiao() { header("Content-type: application/xml"); $sudDay = $_GET['sudDay']; $type = $_GET['type']; $time = $_GET['time']; if ($type == 'index') { $sitemapDates = $this->provider->getSiteMapIndex(); $sitemapIndex = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8" ?><sitemapindex></sitemapindex>'); foreach ($sitemapDates as $item) { $rating = $sitemapIndex->addChild('sitemap'); $loc = $this->config['setting']['base_url'] . $this->config['client_name'] . '?from=x&amp;a=sitemap&amp;time=' . $item; $rating->addChild('loc', $loc); $rating->addChild('lastmod', $item . " 18:00:00"); } echo $sitemapIndex->asXML(); } else { $SimpleXMLElement = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><DOCUMENT></DOCUMENT>'); $where = array(); if (is_numeric($sudDay)) { $where['sudDay'] = $sudDay; } if ($time) { $where['startTime'] = $time; $where['endTime'] = strtotime($time) + 86400; } $products = $this->provider->getProducts($where); $this->makeSitemap($SimpleXMLElement, $products['data'], 'pages/product/index'); $articles = $this->provider->getArticles($where); $this->makeSitemap($SimpleXMLElement, $articles['data'], 'pages/article/index'); $categories = $this->provider->getCategories(); $this->makeSitemap($SimpleXMLElement, $categories, 'pages/category/index'); echo $SimpleXMLElement->asXML(); } } private function makeSitemap(&$xmlObj, $dataArr, $url) { foreach ($dataArr as $key => $item) { $rating = $xmlObj->addChild('item'); $rating->addChild('key', $item['id']); $display = $rating->addChild('display'); $display->addChild('title', $item['title']); if ($item['description']) { $display->addChild('description', mb_substr(str_replace('*', '', $item['description']), 0, 60)); } if ($item['logo']) { $display->addChild('pic', $item['logo']); } $display->addChild('create_time', date('Y-m-d H:i:s', $item['add_time'])); if ($item['from']) { $display->addChild('from', $item['from']); } if ($item['url']) { $display->addChild('url', $item['url']); } $display->addChild('lightapp_url', $url . '?url=' . $item['id']); $display->addChild('lightappid_url', $this->config['weapp']['app_id']); } } public function mappingAction() { $sitemap = $this->provider->getMapping(); header("Content-type:text/plan"); foreach ($sitemap as $key => $item) { echo "{$item['url']} => {$item['path']}\r\n"; } die; } private function _pageConfig($data) { if (!$data['seo_title']) { $data['seo_title'] = $data['title']; } $this->data['page_config'] = array( "seo_title" => $data['seo_title'], "keywords" => $data['keywords'], "description" => $data['description'], "title" => $data['title'] ? $data['title'] : $data['seo_title'], "add_time" => $data['add_time'], "image" => $data['logo'], ); } } class pdoMysql { private $config = null; public $link = null; public $lastqueryid = null; public $querycount = 0; private $reconnectCount = 0; private $sql=""; public function __construct($config) { if (!$config['port']) { $config['port'] = 3306; } if (!$config['charset']) { $config['charset'] = 'utf8'; } $this->config = $config; $this->config['dsn'] = 'mysql:host=' . $config['host'] . ';port=' . $config['port'] . ';dbname=' . $config['database']; $this->connect(); } private function connect() { if ($this->reconnectCount > 3) { res(1002, '数据库重连失败'); } $this->reconnectCount++; try { $this->link = new PDO($this->config['dsn'], $this->config['user'], $this->config['password'], array( PDO::ATTR_PERSISTENT => true, PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8" )); } catch (Exception $e) { res(1002, $e->getMessage()); $this->link = null; return null; } $this->link->query("set sql_mode=''"); return $this->link; } public function execute($sql) { if (!is_object($this->link)) { $result = $this->connect(); if (!$result) { res(1002, '数据库重连失败'); } } $this->lastqueryid = $this->link->exec($sql); $errNo = $this->errno(); if ($errNo == 2003 || $errNo == 2006) { $this->connect(); return $this->execute($sql); } elseif ($errNo > 0) { res(-1, $this->error($sql)); } $this->querycount++; return $this->lastqueryid; } public function query($sql = null) { if (!is_object($this->link)) { $result = $this->connect(); if (!$result) { res(1002, '数据库重连失败'); } } $this->lastqueryid = $this->link->query($sql); $errNo = $this->errno(); if ($errNo == 2003 || $errNo == 2006) { $this->connect(); return $this->query($sql); } elseif ($errNo > 0) { res(-1, $this->error($sql)); } $this->querycount++; return $this->lastqueryid; } public function querySelect($sql, $limit = '', $order = '', $group = '', $key = '') { $sql = $this->sql.' '.$sql; $order = $order == '' ? '' : ' orDER BY ' . $order; $group = $group == '' ? '' : ' GROUP BY ' . $group; $limit = $limit == '' ? '' : ' LIMIT ' . $limit; $sql = $sql . $group . $order . $limit; $this->query($sql); if (!is_object($this->lastqueryid)) { return $this->lastqueryid; } $datalist = $this->lastqueryid->fetchAll(); if ($key) { $datalist_new = array(); foreach ($datalist as $i => $item) { $datalist_new[$item[$key]] = $item; } $datalist = $datalist_new; unset($datalist_new); } $this->freeResult(); $this->sql = ''; return $datalist; } public function select($data, $table, $where = '', $limit = '', $order = '', $group = '', $key = '') { $where = $where == '' ? '' : ' Where ' . $where; $order = $order == '' ? '' : ' orDER BY ' . $order; $group = $group == '' ? '' : ' GROUP BY ' . $group; $limit = $limit == '' ? '' : ' LIMIT ' . $limit; $field = explode(',', $data); array_walk($field, array($this, 'addSpecialChar')); $data = implode(',', $field); $sql = 'Select ' . $data . ' FROM `' . $this->config['database'] . '`.`' . $this->getTable($table) . '`' . $where . $group . $order . $limit; $this->query($sql); if (!is_object($this->lastqueryid)) { return $this->lastqueryid; } $datalist = $this->lastqueryid->fetchAll(); if ($key) { $datalist_new = array(); foreach ($datalist as $i => $item) { $datalist_new[$item[$key]] = $item; } $datalist = $datalist_new; unset($datalist_new); } $this->freeResult(); return $datalist; } public function getOne($data, $table, $where = '', $order = '', $group = '') { $where = $where == '' ? '' : ' Where ' . $where; $order = $order == '' ? '' : ' orDER BY ' . $order; $group = $group == '' ? '' : ' GROUP BY ' . $group; $limit = ' LIMIT 1'; $field = explode(',', $data); array_walk($field, array($this, 'addSpecialChar')); $data = implode(',', $field); $table = explode(' as ',$table); $table = '`.`' . $this->getTable($table[0]) . '`' . ($table[1]?' as '.$table[1]:''); $sql = 'Select ' . $data . ' FROM `' . $this->config['database'] .$table. $where . $group . $order . $limit; $this->query($sql); $res = $this->lastqueryid->fetch(); $this->freeResult(); return $res; } public function getOneCol($data, $table, $where = '', $order = '', $group = '') { $where = $where == '' ? '' : ' Where ' . $where; $order = $order == '' ? '' : ' orDER BY ' . $order; $group = $group == '' ? '' : ' GROUP BY ' . $group; $limit = ' LIMIT 1'; $field = explode(',', $data); array_walk($field, array($this, 'addSpecialChar')); $data = implode(',', $field); $fieldname = str_replace('`', '', $data); $sql = 'Select ' . $data . ' FROM `' . $this->config['database'] . '`.`' . $this->getTable($table) . '`' . $where . $group . $order . $limit; $this->query($sql); $res = $this->lastqueryid->fetch(); $this->freeResult(); $result = isset($res[$fieldname]) ? $res[$fieldname] : false; return $result; } public function insert($data, $table, $return_insertId = false, $replace = false) { if (!is_array($data) || $table == '' || count($data) == 0) { return false; } $fielddata = array_keys($data); $valuedata = array_values($data); array_walk($fielddata, array($this, 'addSpecialChar')); array_walk($valuedata, array($this, 'escapeString')); $field = implode(',', $fielddata); $value = implode(',', $valuedata); $cmd = $replace ? 'REPLACE INTO' : 'Insert INTO'; $sql = $cmd . ' `' . $this->config['database'] . '`.`' . $this->getTable($table) . '`(' . $field . ') VALUES (' . $value . ')'; $return = $this->execute($sql); return $return_insertId ? $this->insertId() : $return; } public function update($data, $table, $where = '', $order = "", $limit = "") { if ($table == '' or $where == '') { return false; } $where = ' Where ' . $where; if (is_string($data) && $data != '') { $field = $data; } elseif (is_array($data) && count($data) > 0) { $fields = array(); foreach ($data as $k => $v) { switch (substr($v, 0, 2)) { case '+=': $v = substr($v, 2); if (is_numeric($v)) { $fields[] = $this->addSpecialChar($k) . '=' . $this->addSpecialChar($k) . '+' . $this->escapeString($v, '', false); } break; case '-=': $v = substr($v, 2); if (is_numeric($v)) { $fields[] = $this->addSpecialChar($k) . '=' . $this->addSpecialChar($k) . '-' . $this->escapeString($v, '', false); } break; default: if (preg_match('/^`[a-z_0-9]+`\s*[\+\-]\s*[0-9]+$/', $v)) { $fields[] = $this->addSpecialChar($k) . '=' . $v; } else { $fields[] = $this->addSpecialChar($k) . '=' . $this->escapeString($v); } } } $field = implode(',', $fields); } else { return false; } $order = !empty($order) ? " orDER BY " . $order : ""; $limit = !empty($limit) ? " LIMIT " . $limit : ""; $sql = 'Update `' . $this->config['database'] . '`.`' . $this->getTable($table) . '` SET ' . $field . $where . $order . $limit; return $this->execute($sql); } public function delete($table, $where) { if ($table == '' || $where == '') { return false; } $where = ' Where ' . $where; $sql = 'Delete FROM `' . $this->config['database'] . '`.`' . $this->getTable($table) . '`' . $where; return $this->execute($sql); } public function count($where = '', $table, $group = '') { $r = $this->getOne("COUNT(*) AS num", $table, $where, '', $group); return $r['num']; } public function fetchAll($res = null) { $type = PDO::FETCH_ASSOC; if ($res) { $res_query = $res; } else { $res_query = $this->lastqueryid; } return $res_query->fetchAll($type); } public function affectedRows() { return is_numeric($this->lastqueryid) ? $this->lastqueryid : 0; } public function getPrimary($table) { $this->query("SHOW COLUMNS FROM " . $this->getTable($table)); while ($r = $this->lastqueryid->fetch()) { if ($r['Key'] == 'PRI') { break; } } return $r['Field']; } public function getFields($table) { $fields = array(); $this->query("SHOW COLUMNS FROM " . $this->getTable($table)); while ($r = $this->lastqueryid->fetch()) { $fields[$r['Field']] = $r['Type']; } return $fields; } public function checkFields($table, $array) { $fields = $this->getFields($table); $nofields = array(); foreach ($array as $v) { if (!array_key_exists($v, $fields)) { $nofields[] = $v; } } return $nofields; } public function tableExists($table) { $tables = $this->listTables(); return in_array($table, $tables) ? 1 : 0; } public function listTables() { $tables = array(); $this->query("SHOW TABLES"); while ($r = $this->lastqueryid->fetch()) { $tables[] = $r['Tables_in_' . $this->config['database']]; } return $tables; } public function fieldExists($table, $field) { $fields = $this->getFields($table); return array_key_exists($field, $fields); } public function getTable($table) { if (!$this->config['prefix']) { return $table; } if (strpos($table, $this->config['prefix']) === false) { return $this->config['prefix'] . $table; } return $table; } public function numRows($sql) { $this->query($sql); return $this->lastqueryid->rowCount(); } public function num_fields($sql) { $this->query($sql); return $this->lastqueryid->columnCount(); } public function result($sql, $row) { $this->query($sql); return $this->lastqueryid->fetchColumn($row); } public function error($msg = null) { $err = $this->link->errorInfo(); if($msg){ $err[] = $msg; } return $err; } public function errno() { return intval($this->link->errorCode()); } public function insertId() { return $this->link->lastInsertId(); } public function freeResult() { if (is_object($this->lastqueryid)) { $this->lastqueryid = null; } } public function close() { if (is_object($this->link)) { unset($this->link); } } public function addSpecialChar(&$value) { if ('*' == $value || false !== strpos($value, '(') || false !== strpos($value, '.') || false !== strpos($value, '`') || false !== strpos(strtolower($value), 'as')) { } else { $value = '`' . trim($value) . '`'; } if (preg_match("/\b(select|insert|update|delete)\b/i", $value)) { $value = preg_replace("/\b(select|insert|update|delete)\b/i", '', $value); } return $value; } public function escapeString(&$value, $key = '', $quotation = 1) { if ($quotation) { $q = '\''; } else { $q = ''; } $value = $q . $value . $q; return $value; } public function halt($message = '', $sql = '') { res(-1, 'Errno :' . $sql . implode(' ', $this->link->errorInfo())); } public function convertEncoding($string, $from_encoding = 'GBK', $target_encoding = 'UTF-8') { if (is_array($string)) { foreach ($string as $key => $value) { $string[$key] = $this->convertEncoding($value, $from_encoding, $target_encoding); } } else { if (function_exists('mb_convert_encoding')) { $string = mb_convert_encoding($string, str_replace('//IGNORE', '', strtoupper($target_encoding)), $from_encoding); } else { if (strtoupper($target_encoding) == 'GB2312' or strtoupper($target_encoding) == 'GBK') { $target_encoding .= '//IGNORE'; } $string = iconv($from_encoding, $target_encoding, $string); } } return $string; } final function from($data='*',$table,$as='') { $as = $as ? (' as ' . $as) : ''; preg_match("/^{$this->config['prefix']}/", $table, $m); if (!$m) $table = $this->config['prefix'] . $table; $this->sql = 'Select ' . $data . ' FROM ' . $table . $as; return $this; } final function join($dbName,$sql,$type='INNER') { preg_match("/^{$this->config['prefix']}/",$dbName,$m); if(!$m) $dbName = $this->config['prefix'].$dbName; $this->sql .= ' '.$type.' JOIN '.$dbName." ON (".$sql.') '; return $this; } final function where($sql) { if( $sql ) { $this->sql .= ' where '.$sql; } return $this; } } class categoryTree { public $categories; public $tree = array(); public $deep = 1; public $icon = array('└&nbsp;&nbsp;','','', ''); public $parent_name = 'parent_id'; public $id_name = 'id'; public $tmps; public function __construct($categories = null, $id_name = 'id', $parent_name = 'parent_id') { $this->categories = $categories; $this->parent_name = $parent_name; $this->id_name = $id_name; $this->tmps = array(); } public function getTree($rootId = 0, $add = '', $parent_end =false, $excludeId = null) { $rootId = intval($rootId); $is_top = 1; if ($excludeId && $excludeId == $rootId) { return; } $child_arr = $this->getChild($rootId); $space = $this->icon[3]; if (is_array($child_arr)) { $cnt = count($child_arr); foreach ($child_arr as $key => $child) { $cid = $child[$this->id_name]; if ($this->deep >1) { if ($is_top == 1 && $this->deep > 1) { $space = $this->icon[1]; $add .= $this->icon[0]; } if ($is_top == $cnt) { $space = $this->icon[2]; $parent_end = true; } else { $space = $this->icon[1]; $parent_end = false; } } $child['spacer'] = $add . $space; if (!isset($this->tree[$child[$this->id_name]])) { $this->tree[$child[$this->id_name]] = $child; } $is_top++; $this->deep++; if ($this->getChild($cid)) { if ($excludeId && $excludeId == $cid) { continue; } $this->getTree($cid, $add, $parent_end, $excludeId); $this->deep--; } } } return array_values($this->tree); } public function getTreeChild($rootId = 0) { $rootId = intval($rootId); $tmp = array(); foreach ($this->categories as $node) { $tmp[$node[$this->parent_name]][$node[$this->id_name]] = $node; } krsort($tmp); foreach ($tmp as $pid => &$childs) { foreach ($childs as &$child) { if (isset($tmp[$child[$this->id_name]])) { $child['child'] = array_values($tmp[$child[$this->id_name]]); } } } return array_values($tmp[$rootId]); } public function getChild($root = 0) { if (!$this->tmps) { foreach ($this->categories as $node) { $this->tmps[$node[$this->parent_name]][] = $node; } } $child = array(); if (isset($this->tmps[$root])) { $child = $this->tmps[$root]; } return $child?$child:false; } } function getClientIp() { $ip = $_SERVER['REMOTE_ADDR']; if (isset($_SERVER['HTTP_CLIENT_IP']) && preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif(isset($_SERVER['HTTP_X_FORWARDED_FOR']) AND preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#s', $_SERVER['HTTP_X_FORWARDED_FOR'], $matches)) { foreach ($matches[0] AS $xip) { if (!preg_match('#^(10|172\.16|192\.168)\.#', $xip)) { $ip = $xip; break; } } } if(isset($_SERVER['HTTP_REQUEST_IP'])){ $ip = $_SERVER['HTTP_REQUEST_IP']; } return $ip; } function baseUrl() { static $baseUrl; if ($baseUrl) { return $baseUrl; } $isHttps = false; if (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') { $isHttps = true; } elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { $isHttps = true; } elseif (!empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') { $isHttps = true; } $dirNameArr = explode('/', $_SERVER['REQUEST_URI']); array_pop($dirNameArr); $dirName = implode("/", $dirNameArr) . "/"; $baseUrl = ($isHttps ? "https" : "http") . "://" . $_SERVER["HTTP_HOST"] . $dirName; return $baseUrl; } function res($code, $msg = null, $data = null, $extra = null) { @header('Content-Type:application/json;charset=UTF-8'); if(is_array($msg)){ $msg = implode(",", $msg); } $output = array( 'code' => $code, 'msg' => $msg, 'data' => $data ); if (is_array($extra)) { foreach ($extra as $key => $val) { $output[$key] = $val; } } echo json_encode($output); die; } function showMessage($msg, $code = -1) { $from = $_GET['from']; if ($from == 'x') { res($code, $msg); } @header('Content-Type:text/html;charset=UTF-8'); echo "<div style='padding: 50px;text-align: center;'>$msg</div>"; die; } function request($url, $method = 'GET', $postFields = null, $time_out = 5) { $curl = curl_init(); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 3); curl_setopt($curl, CURLOPT_TIMEOUT, $time_out); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, false); if (is_array($postFields)) { $postFields = http_build_query($postFields); } $method = strtoupper($method); if ($method == 'POST') { curl_setopt($curl, CURLOPT_POST, true); if ($postFields) { curl_setopt($curl, CURLOPT_POSTFIELDS, $postFields); } } else { if ($postFields) { if (strpos($url, '?') !== false) { $url .= "&" . $postFields; } else { $url .= "?" . $postFields; } } } curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLINFO_HEADER_OUT, true); if (substr($url, 0, 8) == 'https://') { curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); } $response = curl_exec($curl); curl_close($curl); return $response; } function parseAction($a) { $a = lcfirst(str_replace(" ", "", ucwords(str_replace(array("/", "_"), " ", $a)))); return $a; } if (!function_exists('array_column')) { function array_column($rows, $column_key, $index_key = null) { if (!$rows) { return array(); } $data = array(); if (empty($index_key)) { foreach ($rows as $row) { $data[] = $row[$column_key]; } } else { foreach ($rows as $row) { $data[$row[$index_key]] = $row; } } return $data; } } $errorCodes = array( 0 => '正常', -1 => '普通错误', 101 => '没有授权', 102 => '版本过旧', 1001 => '访问受限', 1002 => '没有配置或配置错误', 1003 => '空间不支持', );


    本文网址:http://www.tiantianxiaoxiao.com/tiantianxiaoxiao/3457.html
    读完这篇文章后,您心情如何?
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0