This article mainly describes the thinkphp in the PHP7 environment prompt cannot use ' String ' as class name as it is reserved solution, involving thinkphp for PHP7 keyword determination of the relevant underlying code modification techniques, A friend you need can refer to the following
The example in this paper describes the thinkphp in the PHP7 environment that prompts cannot use ' String ' as class name as it is reserved solution. Share to everyone for your reference, as follows:
I have a website before using PHP7 run thinkphp no problem, but recently found to open the verification code when found to have errors
Cannot use ' String ' as class name as it is reserved
Google Baidu search for a bit or no workaround
So I was the first one to share it.
Reason:
There is a class with the string class name, PHP7 string as the keyword
Workaround:
File thinkphp\library\org\util\image.class.php
Found it:
Import (' ORG. Util.string '); $code = String::rand_string ($length, 4);
Modified to:
Import (' ORG. Util.stringnew '); $code = Stringnew::rand_string ($length, 4);
To copy a file:
thinkphp\library\org\util\string.class.php
Save As:
thinkphp\library\org\util\stringnew.class.php
Open Stringnew.class.php:
Class String {
Modified to:
Class Stringnew {
Put the verification code out, I searched for it. No other references, this problem solved