In PHP scripts, whether calling include() , require() , fopen() , or their derivatives such as include_once , require_once , or even, move_uploaded_file() , one often runs into an error or warning: Failed to open stream : No such file or directory. What is a good process to quickly find the root cause of the problem? There are many reasons why one might run into this error and thus a good c
在PHP脚本中,无论是调用include() , require() , fopen()还是其派生词,如include_once , require_once或move_uploaded_file() ,都会遇到错误或警告: 无法打开流:没有这样的文件或目录。 什么是快速找到问题根源的好过程? 有很多原因可能会导致这个错误,因此一个很好的核对清单首先要检查什么会有相当大的帮助。 让我们考虑一下,我们正在解决以下问题: require "/path/to/file" 清单 1.检查文件路径是否
When i'm using following code then fatal error generate. echo empty(is_resource(true)); Error: Fatal error: Can't use function return value in write context. Why? empty requires a variable as if the parameter were passed by reference: Note: empty() only checks variables as anything else will result in a parse error. In other words, the following will not work: empty(trim($nam
当我使用以下代码时,会生成致命错误。 echo empty(is_resource(true)); 错误: 致命错误:不能在写入上下文中使用函数返回值。 为什么? 如果参数是通过引用传递的,则empty需要一个变量: 注意: empty()只检查变量,否则会导致分析错误。 换句话说,以下内容不起作用: empty(trim($name)) 。 所以你可以这样做: $var = is_resource(true); echo empty($var); 但是由于is_resource已经返回一个布尔值,所以
Newb here trying to fix my php code. Getting an error at line 89. <?php /** * @version $Id: index.php 10381 2008-06-01 03:35:53Z pasamio $ * @package Joomla * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. * @license GNU/GPL, see LICENSE.php * Joomla! is free software. This version may have been modified pursuant * to the GNU General Public L
Newb在这里试图解决我的PHP代码。 在第89行发生错误。 <?php /** * @version $Id: index.php 10381 2008-06-01 03:35:53Z pasamio $ * @package Joomla * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. * @license GNU/GPL, see LICENSE.php * Joomla! is free software. This version may have been modified pursuant * to the GNU General Public License, and as
I got an error: Parse error: syntax error, unexpected end of file in the line With this code: <html> <?php function login() { // Login function code } if (login()) {?> <h2>Welcome Administrator</h2> <a href="upload.php">Upload Files</a> <br /> <a href="points.php">Edit Points Ta
我遇到了一个错误: Parse error: syntax error, unexpected end of file in the line 使用此代码: <html> <?php function login() { // Login function code } if (login()) {?> <h2>Welcome Administrator</h2> <a href="upload.php">Upload Files</a> <br /> <a href="points.php">Edit Points Ta
I have this code that processes a user then redirects them to the user homepage. <?php $username = $_POST['username']; $password = $_POST['pwd']; $file = file_get_contents("userdb.html"); if(!strpos($file, $username)) { echo "Your username was not found in our database. Please go back and try again."; } else { echo "Redirecting..."; if (md5($passwo
我有这个处理用户的代码,然后将它们重定向到用户主页。 <?php $username = $_POST['username']; $password = $_POST['pwd']; $file = file_get_contents("userdb.html"); if(!strpos($file, $username)) { echo "Your username was not found in our database. Please go back and try again."; } else { echo "Redirecting..."; if (md5($password) == !strpos($file, (md5($
I am trying to select data from a MySQL table, but I get one of the following error messages: mysql_fetch_array() expects parameter 1 to be resource, boolean given or mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given or Call to a member function fetch_array() on boolean / non-object This is my code: $username = $_POST['username']; $password = $_POST['passwor
我试图从MySQL表中选择数据,但是我收到以下错误消息之一: mysql_fetch_array()期望参数1是资源,布尔给定 要么 mysqli_fetch_array()期望参数1是mysqli_result,布尔给定 要么 在布尔/非对象上调用成员函数fetch_array() 这是我的代码: $username = $_POST['username']; $password = $_POST['password']; $result = mysql_query('SELECT * FROM Users WHERE UserName LIKE $username'); while($row = mys
I am running a PHP script, and keep getting errors like: Notice: Undefined variable: my_variable_name in C:wampwwwmypathindex.php on line 10 Notice: Undefined index: my_index C:wampwwwmypathindex.php on line 11 Line 10 and 11 looks like this: echo "My variable value is: " . $my_variable_name; echo "My index value is: " . $my_array["my_index"]; What do these errors mean? Why do they appe
我正在运行一个PHP脚本,并不断收到像这样的错误: 注意:未定义变量:第10行的C: wamp www mypath index.php中的my_variable_name 注意:第11行的未定义索引:my_index C: wamp www mypath index.php 第10和11行看起来像这样: echo "My variable value is: " . $my_variable_name; echo "My index value is: " . $my_array["my_index"]; 这些错误意味着什么? 他们为什么突然出现? 我曾经使用这个脚本多年
I installed XAMPP 1.7.4 (with PHP 5.3.5), the problem is PHP does not display any error messages. Eg if I connect to MYSQL with mysql_connect() without parameters, PHP will not complain about the required fields. Why is this? How can I configure PHP to display errors? To turn on errors at the script level, include at the top of your script: ini_set('display_errors', 1); error_reporting(~0
我安装了XAMPP 1.7.4(使用PHP 5.3.5),问题是PHP不显示任何错误消息。 例如,如果我使用不带参数的mysql_connect()连接到MYSQL,PHP将不会抱怨所需的字段。 为什么是这样? 我如何配置PHP来显示错误? 要在脚本级别打开错误,请在脚本顶部包含以下内容: ini_set('display_errors', 1); error_reporting(~0); 另外,如果它不是一个生产站点,只是一个开发/测试站点,您可以打开php.ini中的错误报告。 搜索它以获取这
After debugging a codeigniter app that were installed into a new development environment, I have started to freak out when seeing white screens with nothing more available. I have been able to solve each and every one of the errors that have caused this, but it have taken seriously way too long time. PHP error_reporting(E_ALL) & display_errors", 1 is set as well. I even installed Xdeb
在调试安装到新开发环境中的codeigniter应用程序后,当看到没有更多可用的白色屏幕时,我开始大吃一惊。 我已经能够解决导致这种错误的每一个错误,但是它认真地考虑了太久的时间。 PHP error_reporting(E_ALL) & display_errors", 1被设置,我甚至安装了Xdebug以获得更多输出,但是没有。我的日志记录设置也在工作,但是没有任何内容写入日志。 有没有办法获得一些信息打印出来,而不是一个完整的白色屏幕? 这肯定
Now that I'm starting to get back into PHP, I'm starting to remember why I gave it up in the first place. The most annoying thing on my plate at the moment is what I've come to term "PHP's white screen of death". When PHP gets a fatal error due to syntax or whatever, it seems like it will always die without actually sending anything to the browser. I've added the
现在我开始回到PHP,我开始记住为什么我放弃了它。 我现在最讨厌的东西就是我所说的“PHP的死亡白屏”。 当PHP由于语法或其他原因而发生致命错误时,似乎在没有实际向浏览器发送任何东西的情况下,它总是会死掉。 我已将以下内容添加到我的.htaccess ,并且它似乎在大多数时间都有效,但在这些情况下它不起作用。 php_value display_errors 1 php_value display_startup_errors 1 php_value error_reporting 2147483647 # E_ALL