php - 使用substr 出现Use of undefined constant 0 - assumed ' 0'
本文介绍了php - 使用substr 出现Use of undefined constant 0 - assumed ' 0'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
php版本5.6中使用substr
函数 进行字符串截取。代码如下
substr("123456", 0, 2);
出现Use of undefined constant 0 - assumed ' 0'
网上解决方案是修改 php.ini 中error_reporting
将notice
关闭。但是这个本质问题是什么?? 如果不关闭这个notice
配置,怎么解决??
解决方案
谢邀!
不是函数的问题,而是你使用了未定义的常量0,你可以再去看看你的代码。你的上下文中的0是不是加了个全角的空格。
这篇关于php - 使用substr 出现Use of undefined constant 0 - assumed ' 0'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文