小编use*_*835的帖子

如何正确打印变量到PHP错误日志

我正在尝试正确地将变量打印到错误日志中,以便我知道我的MySQL查询是否有效,但它不会在我的errorlog.log文件中打印任何内容.我在下面设置了所有内容,我将错误设置为true并告诉它要打印到的文件,但它根本不打印任何内容:

<?php

error_reporting(E_ALL); //to set the level of errors to log, E_ALL sets all warning, info , error

ini_set("log_errors", true);
ini_set("error_log", "/errorlog.log"); //send error log to log file specified here.

include ("connection.php");

$city = $_POST['city'];

$state = $_POST['state'];

$results = array();
if( $query =  $db->query("SELECT business_id, BusinessName, date, post".
"FROM WolfeboroC.posts".
"JOIN WolfeboroC.users ON users.recid = posts.business_id".
"WHERE city= '$city' && state='$state' ".
"ORDER BY date DESC LIMIT 0, 500") ) 
{
  while($record = $query->fetch_assoc())
  {
Run Code Online (Sandbox Code Playgroud)

$results …

php

12
推荐指数
1
解决办法
3万
查看次数

标签 统计

php ×1