我想得到最后的询问。 我只能从核心上 turn。 php和我可以在当地操作该守则。 我需要一种途径,才能把最后的 s子 que到错误的标识上,而不会影响现场。 这个问题已经失败,但正在处理之中。
如此之大:
$this->log($this->ModelName->lastQuery);
提前感谢。
我想得到最后的询问。 我只能从核心上 turn。 php和我可以在当地操作该守则。 我需要一种途径,才能把最后的 s子 que到错误的标识上,而不会影响现场。 这个问题已经失败,但正在处理之中。
如此之大:
$this->log($this->ModelName->lastQuery);
提前感谢。
ake2.0保护了查询记录,以便这项工作完成。
function getLastQuery() {
$dbo = $this->getDatasource();
$logs = $dbo->getLog();
$lastLog = end($logs[ log ]);
return $lastLog[ query ];
}
CakePHP v2.3.2
$log = $this->Model->getDataSource()->getLog(false, false);
debug($log);
在CakePHP 1.x中,你想要的数据可在上查阅。 数据来源:_queries Carlo
。 地震确实为这一成员提供了一种方便的方法,但背后的语言是PHP,这丝毫没有阻止你做以下工作:
在app/app_model.php
:
function getLastQuery()
{
$dbo = $this->getDatasource();
$logs = $dbo->_queriesLog;
return end($logs);
}
你们可以在线使用。
$dbo = $this->Model->getDatasource();
// store old state
$oldStateFullDebug = $dbo->fullDebug;
// turn fullDebug on
$dbo->fullDebug = true;
// Your code here! eg.
$this->Model->find( all );
// write to logfile
// use print_r with second argument to return a dump of the array
Debugger::log(print_r($dbo->_queriesLog, true));
// restore fullDebug
$dbo->fullDebug = $oldStateFullDebug;
简单易懂的行文记录仪
var_dump($this->YourModel->getDataSource()->showLog());
这是很晚的答复,即知道的,但对于今后需要的人来说,你总是能够限制对你的欺骗。 IP, for example:
Configure::write( debug , 0);
if($_SERVER["REMOTE_ADDR"] == 192.168.0.100 ){
Configure::write( debug , 2); //Enables debugging only for your IP.
}
1. 专题和空白解决办法的组合(在排出2号时的工作):
$dbo = $this->Model->getDatasource();
$oldStateFullDebug = $dbo->fullDebug;
$dbo->fullDebug = true;
// find or whatever...
$this->Model->find("all");
$logs = $dbo->getLog();
$lastLog = end($logs[ log ]);
CakeLog::write("DBLog", $lastLog[ query ]);
$dbo->fullDebug = $oldStateFullDebug;
你们可以这样做:
$log = $this->Model->getDataSource()->getLog(false, false);
pr($log);die;
在卡纳克民阵中,有两种办法来看待问题。
这两种方法,你们都必须在估算/比较/分数中增加一行。 php
Configure::write( debug , 2);
第一手方法:
debug($this->getLastQuery());
如果你想把电线上加起来,将这一功能称作get LastQuery(
,使用以下代码,放在相同的控制器上:
public function getLastQuery() {
$dbo = $this->TModel->getDatasource(); //Here TModel is a model.what table you want to print
$logs = $dbo->getLog();
$lastLog = end($logs[ log ]);
return $lastLog[ query ];
}
第二种方法:
在任何内容档案中添加以下一栏。
<?php echo $this->element( sql_dump ); ?>
这将有助于你。
echo <pre> ;
$log = $this->YOUR_MODEL->getDataSource();
print_r($log);
exit;
I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...
<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...
我把我的用心从使用QQL转向MySQL。 它与凯科特合作,现在不工作,因为我已经改变,使用MySQL。 这里的错误信息是:
We have a restaurant table that has lat-long data for each row. We need to write a query that performs a search to find all restaurants within the provided radius e.g. 1 mile, 5 miles etc. We have ...
Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...
Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...
What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...
My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...