662 $startTime = microtime(true);663 664 // Always save the last query so we can use665 // the getLastQuery() method.666 $this->lastQuery = $query;667 668 // Run the query for real669 if (! $this->pretend && false === ($this->resultID = $this->simpleQuery($query->getQuery())))670 {671 $query->setDuration($startTime, $startTime);672 673 // This will trigger a rollback if transactions are being used674 if ($this->transDepth !== 0)675 {676 $this->transStatus = false;
371 * the application run, and does all of the dirty work to get372 * the pieces all working together.373 */374 375 376 $app = new \Phpcmf\Extend\CodeIgniter(config(\Config\App::class));377 $app->initialize();378 $app->run();
require /www/wwwroot//index.php — require()
require /www/wwwroot//admin.php — require()
Displayed at 11:19:17am — PHP: 7.3.5 — CodeIgniter: 4.0.4
mysqli_sql_exception #1054
Unknown column 'id' in 'order clause' 搜索问题 →
SELECT * FROM `mac_vod` ORDER BY `id` desc LIMIT 10SYSTEMPATH/Database/MySQLi/Connection.php at line 331
324 if ($res = $this->connID->store_result())325 {326 $res->free();327 }328 }329 try330 {331 return $this->connID->query($this->prepQuery($sql));332 }333 catch (\mysqli_sql_exception $e)334 {335 log_message('error', $e);336 if ($this->DBDebug)337 {338 throw $e;- SYSTEMPATH/Database/MySQLi/Connection.php : 331 — mysqli->query ( arguments )
- SYSTEMPATH/Database/BaseConnection.php : 741 — CodeIgniter\Database\MySQLi\Connection->execute ( arguments )
- SYSTEMPATH/Database/BaseConnection.php : 669 — CodeIgniter\Database\BaseConnection->simpleQuery ( arguments )
- SYSTEMPATH/Database/BaseBuilder.php : 1860 — CodeIgniter\Database\BaseConnection->query ( arguments )
- FCPATH/Fcms/Core/Model.php : 787 — CodeIgniter\Database\BaseBuilder->get ()
- APPPATH/Api/diy.php : 20 — Phpcmf\Model->limit_page ( arguments )
- require APPPATH/Models/Http.php — require()
- APPPATH/Controllers/Admin/Http.php : 93 — Phpcmf\Model\Httpapi\Http->get_api_data ( arguments )
- SYSTEMPATH/CodeIgniter.php : 918 — Phpcmf\Controllers\Admin\Http->test_index ()
- SYSTEMPATH/CodeIgniter.php : 404 — CodeIgniter\CodeIgniter->runController ( arguments )
- SYSTEMPATH/CodeIgniter.php : 312 — CodeIgniter\CodeIgniter->handleRequest ( arguments )
- FCPATH/Fcms/Init.php : 378 — CodeIgniter\CodeIgniter->run ()
- require /www/wwwroot//index.php — require()
- require /www/wwwroot//admin.php — require()
Displayed at 11:19:17am — PHP: 7.3.5 — CodeIgniter: 4.0.4324 if ($res = $this->connID->store_result())325 {326 $res->free();327 }328 }329 try330 {331 return $this->connID->query($this->prepQuery($sql));332 }333 catch (\mysqli_sql_exception $e)334 {335 log_message('error', $e);336 if ($this->DBDebug)337 {338 throw $e;734 public function simpleQuery(string $sql)735 {736 if (empty($this->connID))737 {738 $this->initialize();739 }740 741 return $this->execute($sql);742 }743 744 //--------------------------------------------------------------------745 746 /**747 * Disable Transactions748 *662 $startTime = microtime(true);663 664 // Always save the last query so we can use665 // the getLastQuery() method.666 $this->lastQuery = $query;667 668 // Run the query for real669 if (! $this->pretend && false === ($this->resultID = $this->simpleQuery($query->getQuery())))670 {671 $query->setDuration($startTime, $startTime);672 673 // This will trigger a rollback if transactions are being used674 if ($this->transDepth !== 0)675 {676 $this->transStatus = false;1853 if (! is_null($limit))1854 {1855 $this->limit($limit, $offset);1856 }1857 1858 $result = $this->testMode1859 ? $this->getCompiledSelect($reset)1860 : $this->db->query($this->compileSelect(), $this->binds, false);1861 1862 if ($reset === true)1863 {1864 $this->resetSelect();1865 1866 // Clear our binds so we don't eat up memory1867 $this->binds = [];780 }781 }782 783 $param = $this->_limit_page_where($select, $param);784 if ($size > 0) {785 $select->limit($size, $size * ($page - 1));786 }787 $query = $select->orderBy($order_str ? $order_str : 'id desc')->get();788 if (!$query) {789 log_message('error', '数据查询失败:'.$this->table);790 $this->_clear();791 return [[], $total, $param];792 }793 $data = $query->getResultArray();79413 $return = []; // 返回数据14 15 $db2 = \Config\Database::connect('mac', false);16 17 // 通过db2查询 cms2的member表数据18 19 \Phpcmf\Service::M()->db = $db2;20 list($data) = \Phpcmf\Service::M()->table('vod')->limit_page(10);21 22 if ($data) {23 24 foreach ($data as $r) {25 26 $return[] = [2786 exit(dr_lang('接口数据不存在')); 87 } 88 $content = dr_string2array($data['content']); 89 if (!$content) { 90 exit(dr_lang('接口数据定义内容不存在')); 91 } 92 93 $rt = \Phpcmf\Service::M('http', APP_DIR)->get_api_data($content); 94 echo SITE_URL.'index.php?s=httpapi&id='.$id.'&appid=需要填写值&appsecret=需要填写值'; 95 echo '<hr>'; 96 echo '<pre>'; 97 print_r($rt); 98 exit; 99 }100911 912 if (method_exists($class, '_remap'))913 {914 $output = $class->_remap($this->method, ...$params);915 }916 else917 {918 $output = $class->{$this->method}(...$params);919 }920 921 $this->benchmark->stop('controller');922 923 return $output;924 }925397 if (! is_callable($this->controller))398 {399 $controller = $this->createController();400 401 // Is there a "post_controller_constructor" event?402 Events::trigger('post_controller_constructor');403 404 $returned = $this->runController($controller);405 }406 else407 {408 $this->benchmark->stop('controller_constructor');409 $this->benchmark->stop('controller');410 }411305 306 $this->response->pretend($this->useSafeOutput)->send();307 $this->callExit(EXIT_SUCCESS);308 }309 310 try311 {312 return $this->handleRequest($routes, $cacheConfig, $returnResponse);313 }314 catch (RedirectException $e)315 {316 $logger = Services::logger();317 $logger->info('REDIRECTED ROUTE at ' . $e->getMessage());318 319 // If the route is a 'redirect' route, it throws/index.php?s=httpapi&id=2&appid=需要填写值&appsecret=需要填写值&page=[翻页数字]
<?php /** * api 示例文件 * 变量介绍javascript:; * $return 表示标准返回变量 */ $return = []; // 返回数据 $db2 = \Config\Database::connect('mac', false); // 通过db2查询 cms2的member表数据 \Phpcmf\Service::M()->db = $db2; list($data) = \Phpcmf\Service::M()->table('vod')->limit_page(10); if ($data) { foreach ($data as $r) { $return[] = [ 'id' => $r['vod_id'], 'username' => $r['vod_name'], ]; } }这个代码复制给我呢,需要改写一下
<?php /** * api 示例文件 * 变量介绍javascript:; * $return 表示标准返回变量 */ $return = []; // 返回数据 $db2 = \Config\Database::connect('mac', false); // 通过db2查询 cms2的member表数据 \Phpcmf\Service::M()->db = $db2; $init = [ 'table' => 'vod', 'order_by' => 'vod_id DESC', ]; list($data) = \Phpcmf\Service::M()->init($init)->limit_page(10); if ($data) { foreach ($data as $r) { $return[] = [ 'id' => $r['vod_id'], 'username' => $r['vod_name'], ]; } }