Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Thinkphp prompts Cannot use 'String' as class name as it is reserved what to do in the php7 environment

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces how thinkphp prompts Cannot use 'String' as class name as it is reserved in the php7 environment. What is introduced in this article is very detailed and has a certain reference value. Interested friends must finish reading it!

I have a website that used to have no problem running thinkphp with php7, but recently found that there was an error when I opened the CAPTCHA.

Cannot use 'String' as class name as it is reserved

After searching on google baidu, there is still no solution.

So I did it myself, and it seemed that I was the first person to share it.

Reason:

One class uses the string class name, and php7 sets String as the keyword

Solution:

File ThinkPHP\ Library\ Org\ Util\ Image.class.php

Find:

Import ('ORG.Util.String'); $code = String::rand_string ($length, 4)

Modified to:

Import ('ORG.Util.Stringnew'); $code = Stringnew::rand_string ($length, 4)

Copy the 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 it up and the CAPTCHA came out. I searched it. There was no reference anywhere else. The problem was solved.

The above is all the contents of the article "thinkphp prompts Cannot use 'String' as class name as it is reserved what to do in the php7 environment". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report