我有以下一行代码:
$all_charity_discounts = array_merge($charity_discounts, $charity_discount_codes);
第一个数组中有一个值(另一个数组),另一个为空。当这段代码运行时,Chrome和Firefox会产生" this web page is not available"/"The connection was reset"错误。
我不明白为什么会发生这种事。更奇怪的是,还会出现以下情况:
- 在该行上方添加新行(可以是空行,或注释)修复它
- 将变量名从$ all_charity_折扣更改为$ all_charity_折扣修复它
- 将变量名从$ all_charity_折扣更改为$ _all_charity_折扣修复它
- 将变量名从$ all_charity_折扣更改为$all_charity_discountsx修复它
- 将变量名从$ all_charity_折扣更改为$ all_charity_折扣仍然会破坏它
我在Windows 7上运行WAMP环境,使用PHP 5.3.10和Apache 2.2.1。该文件被编码为UTF-8,我试过使用Sublime Text 3和notepad++。
当错误发生时,我在apache错误日志中得到这些错误:PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.3.10/ext/php_ffmpeg.dll' - %1 is not a valid Win32 application.'r'n in Unknown on line 0
[notice] Apache/2.2.21 (Win64) mod_ssl/2.2.21 OpenSSL/1.0.0g PHP/5.3.10 configured -- resuming normal operations
Init: Session Cache is not configured [hint: SSLSessionCache]
PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.3.10/ext/php_ffmpeg.dll' - %1 is not a valid Win32 application.'r'n in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.3.10/ext/php_ffmpeg.dll' - %1 is not a valid Win32 application. in Unknown on line 0
但是,我不确定为什么这个变量会触发这些类型的错误。
尝试更新您的wamp或
需要设置error_reporting和display_errors。这些可以在PHP .ini中设置,在Apache中设置(如果您使用PHP作为Apache模块),或者在运行时设置,但是如果您在运行时设置它,那么它将不会影响某些类型的错误,例如解析错误。
为了可移植性——也就是说,如果你想在应用程序中设置它——尝试在.htaccess:
中设置它们。# note: PHP constants such as E_ALL can't be used when setting it in Apache
php_value error_reporting 2147483647
php_flag display_errors on