Php error level, php error level
In the php programming process, you will surely encounter more or less error reminders. These error prompts guide us to write cleaner code. Today, we will first write the error types we listed, first, you need to dig
[PHP]; PHP is also a constantly evolving tool, and its functionality is constantly being Truncated.; and Php.ini's settings change can reflect a considerable change,; It's good to study php.ini before using the new PHP Version.;;;;;;;;;;;;;;;;;;;;
In Windows: The program that was originally running normally in php Tutorial 4.3.0, why did multiple errors be reported in 4.3.1? The general prompt is: Notice: Undefined varialbe: variable name.For example, the following code is available:Copy the
Types of errors in PHP
One, the error of the program itself
This error is easier to handle errors, such as syntax errors or the compiler can not parse, these errors at compile time, will not be compiled, and then according to the wrong prompt, to
Three methods of error handling:Simple "die ()" statementCustom errors and error triggersError ReportingBasic error handling: Using the Die () functionThe first example shows a simple script that opens a text file:php$file=fopen ("welcome.txt","R");?
First, error handling:A) in the process of writing a program, when encountering an error, your reaction? May be more impatient, more annoyingb) After encountering an error: Don't cry, two, three don't hang, four don't pee ...Second, you may
[PHP]; PHP is also a constantly evolving tool, and its functionality is constantly being truncated.; And PHP.ini's settings change can reflect a considerable change,; It's good to study php.ini before using the new PHP version.;;;;;;;;;;;;;;;;;;;;
1. Unusual Uniqueness in PHPThe uniqueness of exceptions in PHP is that exceptions in PHP are different from those in mainstream languages C + + and Java. In Java, exceptions are the only way to report errors, not in PHP, but to treat all anomalies
The default setting for PHP is to display notice warning prompts, which can cause the page to not display properly. You have no defined variables to use directly. However, when editing PHP is not as strict as C + +, programming often will use this
An example is provided:In the Windows environment: Originally in the php4.3.0 of the program, in the 4.3.1 Why many errors, the general hint is: notice:undefined varialbe: variable name.
For example, code that resembles the following:
PHP.ini Chinese Configuration Instructions
;;;;;;;;;;;
; Warning
;;;;;;;;;;;
; This profile is the default setting for newly installed PHP.
; By default, PHP uses this configuration file to install
; This configuration is for development
Chinese
PHP.ini Chinese explanation
Publish time: 02-11-26 author or Source: Leftstar[PHP]; PHP is still an evolving tool, and its functionality is constantly being pruned; and PHP.ini's setting changes can reflect quite a change,; Before using the
In many cases, our PHP files will appear some very difficult to troubleshoot the error, such as the output of Great white page, tuning the wrong. It is possible that PHP's error level masks some non-fatal errors, causing no error prompts. So
Different error handling methods: Simple die () statement custom error function and error trigger error report
Basic error handling: Using the Die () function
if (!file_exists ("Welcome.txt")) {die ("File not Found"); else{$file =fopen
A problem is encountered today in learning the CI framework:
A PHP Error was encountered
Severity:notice
message:undefined Variable:user
Generally in the default normal php file output an undefined declaration of a variable is not reported wrong,
11.28 restricting a directory from parsing PHPCore configuration file ContentsPhp_admin_flag engine offCurl test directly returned the PHP source code, did not parseCurl-x127.0.0.1:80 ' http://123.com/upload/123.php '11.29 Limit User_agentUser_agent
11.28 limit a directory to prevent PHP parsingThis section should be used to optimize settings for static file directories or writable directories, and to prevent malicious attacks by restricting resolution/access to improve security.To edit a
Restrict a directory against parsing PHP1. Modify the virtual host configuration file: php_admin_flag engine off # # Order allow,deny # Deny from all # 2. Test:[[email protected] 111.com]# curl -x127.0.0.1:80
[PHP]
; PHP is still an evolving tool, and its functionality is constantly being pruned
; and PHP.ini's setting changes can reflect quite a change,
; Before using the new PHP version, it would be helpful to look at the php.ini.
;;;;;;;;;;;;;;;;;;;
;
In PHP, the default error handling is simple. An error message is sent to the browser with the file name, line number, and message describing the error.
PHP Error Handling
Error handling is an important part of creating scripts and Web
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.