thinkphp在php7环境下提示Cannot use ‘String’ as class name as it is reserved的解决方法
2016-09-30 14:22
791 查看
本文实例讲述了thinkphp在php7环境下提示Cannot use ‘String' as class name as it is reserved的解决方法。分享给大家供大家参考,具体如下:
我有一网站之前用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 {
放上去验证码出来了,我搜索了一下没有其他地方引用,这个问题解决了
更多关于thinkPHP相关内容感兴趣的读者可查看本站专题:《ThinkPHP入门教程》、《thinkPHP模板操作技巧总结》、《ThinkPHP常用方法总结》、《smarty模板入门基础教程》及《PHP模板技术总结》。
希望本文所述对大家基于ThinkPHP框架的PHP程序设计有所帮助。
您可能感兴趣的文章:
- ecshop适应在PHP7的修改方法解决报错的实现
- centos7 + php7 lamp全套最新版本配置及mongodb和redis教程详解
- CentOS 7.2.1511 编译安装Nginx1.10.1+MySQL5.7.14+PHP7.0.11
- linux平台编译安装PHP7并安装Redis扩展与Swoole扩展实例教程
- PHP7安装Redis扩展教程【Linux与Windows平台】
- PHP7标量类型declare用法实例分析
- PHP7新增运算符用法实例分析
- PHP7匿名类用法分析
- PHP7常量数组用法分析
- PHP7.1方括号数组符号多值复制及指定键值赋值用法分析
- PHP7.1新功能之Nullable Type用法分析
- PHP7 新特性详细介绍
- CentOS 7.2 下编译安装PHP7.0.10+MySQL5.7.14+Nginx1.10.1的方法详解(mini版本)
- yum命令安装php7和相关扩展
- golang 调用 php7详解及实例
相关文章推荐
- php7环境下ThinkPHP报错:Cannot use 'String' as class name as it is reserved
- 关于xcode中提示"_OBJC_CLASS_$_ClassName", referenced from"错误的解决方法
- It is indirectly referenced from required .class files(导入项目报错原因与解决方法)
- is not a class or namespace name解决方法
- It is indirectly referenced from required .class file 错误解决方法
- The project: nameXXX which is referenced by the classpath, does not exist解决方法?
- It is indirectly referenced from required .class files。的解决方法
- 出现类似'CListView' : is not a class or namespace name的原因及解决方法
- is not a class or namespace name解决方法
- Eclipse总是提示The user operation is waiting for background work to complete的解决方法(ubuntu环境下)
- is not a class or namespace name解决方法
- ThinkPHP2.0读取MSSQL提示Incorrect syntax near the keyword 'AS'的解决方法
- "Borland license information was found,but it is not valid for delphi." 的解决方法
- 对于Name属性没有get/set方法引起的:target is null for setProperty(null, "x", [Ljava.lang.String;@1a48515)异常
- SQL server 2005 创建数据库失败提示“Collation <服务器默认值> is not valid”解决方法
- Using getResponseBodyAsStream instead is recommended解决方法
- 如何解决"ANSI C++ forbids data member `ip_opts' with same name as enclosing class"的编译错误
- 在Microsoft SQL Server 2008环境下安装mscrm4.0报“The specified path is not a metabase path”错误解决方法
- NameError: name 'admin' is not defined 解决问题的方法:
- Setup is missing prerequisites: MSXML6--安装SSMS错误提示 解决方法