Error: Use of undefined constant allowhtml and undefined index

Source: Internet
Author: User
Error: Use of undefined constant allowhtml and undefined index
Run the program reported the following error, where is the problem?
Notice:use of undefined constant allowhtml-assumed ' allowhtml ' in/home/wwwroot/kaimen360_com/public_html/uc_client/ Model/base.php on line 69

notice:undefined index:allowhtml in/home/wwwroot/kaimen360_com/public_html/uc_client/model/base.php on line 69
------to solve the idea----------------------
An undefined (nonexistent) association key was used
Error message has been given an error location/home/wwwroot/kaimen360_com/public_html/uc_client/model/base.php on line 69
Please take a look at it yourself.
------to solve the idea----------------------
You are prompted that there is no data for that key name (not present) in the array allowhtml
------to solve the idea----------------------
The Allowhtml key value in the array is not present and is used.
For example:

$arr = Array (' a ' =>123);
echo $arr [' allowhtml ']; This will cause the hint to be undefined.
?>

------to solve the idea----------------------
$a = array ();
echo $a [allowhtml];

The associated key name is not quoted (not a string), and PHP first checks whether it is a constant, because there is no definition, so there is
Notice:use of undefined constant allowhtml-assumed ' allowhtml ' in ...

It then checks whether the array has the same name as the string, because there is no
Notice:undefined index:allowhtml in ...

It's because you didn't write robust code.

Default error_reporting = E_all in php.ini
You can change to error_reporting = E_all ^ E_notice
or execute error_reporting at the beginning of the program (e_all ^ e_notice);
To compensate you for your mistakes.


------to solve the idea----------------------
Reference:
Quote: Reference:

The Allowhtml key value in the array is not present and is used.
For example:

$arr = Array (' a ' =>123);
echo $arr [' allowhtml ']; This will cause the hint to be undefined.
?>



How to solve it?
I migrated the server to report such errors, not migrating the server well before, this is why?


That's because your old server is set to not output notice,warning errors, so it is not displayed.
You can add to the top of the program
error_reporting (e_all^e_notice^e_warning);

Error_reporting (e_all^e_notice^e_warning); Add this sentence to block the warning and prompt errors.
$arr = Array (' a ' =>123);
echo $arr [' allowhtml ']; There's no notice here.
?>
  • 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.