thinkphp in PHP7 environment prompt cannot use ' String ' as class name as it is reserved workaround

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.