最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
解决thinkphp php7 Cannot use ‘String’ as class name as it is reserved
时间:2016-03-25 编辑:简简单单 来源:一聚教程网
我有一网站之前用php7运行thinkphp没有什么问题,但是最近发现开启验证码的时候发现有错误
Cannot use 'String' as class name as it is reserved
在google baidu搜索了一下还是没有解决方法
于是自己动手解决,看来我是第一个分享出来的人
原因:
有一个类用了string类名,php7把String定为关键字
解决方法:
文件ThinkPHP\Library\Org\Util\Image.class.php
找到
import('ORG.Util.String');
$code = String::rand_string($length, 4);
修改成
import('ORG.Util.Stringnew');
$code = Stringnew::rand_string($length, 4);
复制文件
ThinkPHP\Library\Org\Util\String.class.php
保存成
ThinkPHP\Library\Org\Util\Stringnew.class.php
打开Stringnew.class.php
class String {
修改成
class Stringnew {
放上去验证码出来了,我搜索了一下没有其他地方引用,这个问题解决了
-
上一个: php 301重定向跳转解决方法
-
下一个: php版的微信公众号接口发红包程序代码
相关文章
- PHP7 的抽象语法树(AST)带来的变化 09-20
- PHP7 新特性新功能有哪些? 09-01
- PHP7新功能使用教程详解 05-24
- PHP导出数据超时的优化建议解读 10-31
- PHP之mysql位运算解析 10-31
- Laravel实现登录跳转功能解析 10-31