PHP Array键字符串,不带引号 [英] PHP Array key strings without quotation marks
问题描述
我正在将文件移动到服务器,并且正在使用$ _GET [mode]之类的变量,而在'mode'中不包含(单引号)".它在本地完美运行,但是在服务器上却收到通知..我该如何克服呢?这是我的phpinfo文件 phpinfo 有什么办法可以使我们在服务器上也具有相同的行为?
I am moving the files to the server and is using variables like $_GET[mode] without ''(single quotes) in 'mode'. It works perfectly locally but on the server i am getting notices.. How can i overcome this?here is my phpinfo file phpinfo Is there any way we can have same behavior to work on server as well?
推荐答案
如何克服E_NOTICE
s抱怨忘记字符串中的引号?
How can you overcome the E_NOTICE
s that complain that you forgot quotes around your strings?
在字符串周围添加引号.
Add quotes around your strings.
$_GET['mode']
另外,听起来您本地服务器上的error_reporting
级别还不够.它应该很高,以便您在开发网站/应用程序时看到这类错误.
Also it sounds like the error_reporting
level on your local server is not sufficient. It should be high, so that you see these sorts of mistakes as you develop your website/application.
在生产服务器上,它可能设置得较低.
On your production server it may be set lower.
这篇关于PHP Array键字符串,不带引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!