Hướng dẫn what are different types of errors available in php? - các loại lỗi khác nhau có sẵn trong php là gì?

Về cơ bản, một lỗi là một sai lầm trong một chương trình có thể được gây ra bằng cách viết cú pháp không chính xác hoặc mã không chính xác. Một thông báo lỗi được hiển thị trên trình duyệt của bạn chứa tên tệp cùng với vị trí, một thông báo mô tả lỗi và số dòng trong đó xảy ra lỗi.

Thường có các loại lỗi khác nhau. Trong PHP, chủ yếu là bốn loại lỗi được xem xét:

  1. Lỗi cú pháp hoặc lỗi phân tích cú pháp
  2. Lỗi nghiêm trọng
  3. Lỗi cảnh báo
  4. Thông báo lỗi

Chúng tôi sẽ thảo luận chi tiết về tất cả các lỗi này với các ví dụ:

Lỗi cú pháp hoặc lỗi phân tích cú pháp

Lỗi nghiêm trọngParse error. Compiler is used to catch the syntax error at compile time.

Lỗi cảnh báo

Thông báo lỗi

Chúng tôi sẽ thảo luận chi tiết về tất cả các lỗi này với các ví dụ:

Lỗi cú pháp là một sai lầm trong cú pháp của mã nguồn, có thể được thực hiện bởi các lập trình viên do sự thiếu quan tâm hoặc kiến ​​thức của họ. Nó còn được gọi là lỗi phân tích cú pháp. Trình biên dịch được sử dụng để bắt lỗi cú pháp tại thời điểm biên dịch.

Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting ',' or ';' in C:\xampp\htdocs\program\fatalerror.php on line 5

Lưu ý: Lỗi cú pháp dừng thực thi mã. In this above example, a semicolon (;) was missing in line 5. So, it generated a parse error and displayed an error message on browser as given in the output.

Những lỗi này có thể xảy ra do những lý do phổ biến này như trích dẫn không được giải thích, thiếu dấu chấm, dấu ngoặc đơn hoặc thiếu hoặc dấu ngoặc không được giải thích và nhiều hơn nữa. Trong khi biên dịch chương trình, lỗi cú pháp có thể được trình biên dịch bắt. Nó cung cấp một lỗi phân tích cú pháp hoặc thông báo lỗi cú pháp.

Lỗi cú pháp là một sai lầm trong cú pháp của mã nguồn, có thể được thực hiện bởi các lập trình viên do sự thiếu quan tâm hoặc kiến ​​thức của họ. Nó còn được gọi là lỗi phân tích cú pháp. Trình biên dịch được sử dụng để bắt lỗi cú pháp tại thời điểm biên dịch.

Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5

Lưu ý: Lỗi cú pháp dừng thực thi mã. In this above example, dollar ($) symbol was missing in line 5. So, it generated a parse error and displayed an error message on browser as given in the output.

Lỗi nghiêm trọng

Lỗi cảnh báo

Thông báo lỗi

Chúng tôi sẽ thảo luận chi tiết về tất cả các lỗi này với các ví dụ:

Lỗi cú pháp là một sai lầm trong cú pháp của mã nguồn, có thể được thực hiện bởi các lập trình viên do sự thiếu quan tâm hoặc kiến ​​thức của họ. Nó còn được gọi là lỗi phân tích cú pháp. Trình biên dịch được sử dụng để bắt lỗi cú pháp tại thời điểm biên dịch.catch_fatal_error(). Therefore, it generates a fatal error and print an error message on the browser as given below:

Lỗi cú pháp là một sai lầm trong cú pháp của mã nguồn, có thể được thực hiện bởi các lập trình viên do sự thiếu quan tâm hoặc kiến ​​thức của họ. Nó còn được gọi là lỗi phân tích cú pháp. Trình biên dịch được sử dụng để bắt lỗi cú pháp tại thời điểm biên dịch.

Fatal error: Uncaught Error: Call to undefined function catch_fatal_error() in C:\xampp\htdocs\program\fatalerror.php:15 Stack trace: #0 {main} thrown in C:\xampp\htdocs\program\fatalerror.php on line 13

Lỗi cảnh báo

Thông báo lỗi

Chúng tôi sẽ thảo luận chi tiết về tất cả các lỗi này với các ví dụ:

Lỗi cú pháp là một sai lầm trong cú pháp của mã nguồn, có thể được thực hiện bởi các lập trình viên do sự thiếu quan tâm hoặc kiến ​​thức của họ. Nó còn được gọi là lỗi phân tích cú pháp. Trình biên dịch được sử dụng để bắt lỗi cú pháp tại thời điểm biên dịch.

Lỗi cú pháp là một sai lầm trong cú pháp của mã nguồn, có thể được thực hiện bởi các lập trình viên do sự thiếu quan tâm hoặc kiến ​​thức của họ. Nó còn được gọi là lỗi phân tích cú pháp. Trình biên dịch được sử dụng để bắt lỗi cú pháp tại thời điểm biên dịch.

Warning Error:
Warning: include(jtp.php): failed to open stream: No such file or directory in C:\xampp\htdocs\program\fatalerror.php on line 7

Warning: include(): Failed opening 'jtp.php' for inclusion (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\program\fatalerror.php on line 7

Lưu ý: Lỗi cú pháp dừng thực thi mã. In this example, we tried to include a file in our program, which does not exist. So, it generated a warning and displayed an error message.

Thông báo lỗi

Chúng tôi sẽ thảo luận chi tiết về tất cả các lỗi này với các ví dụ:For example - access to undefined variable.

Lỗi cú pháp là một sai lầm trong cú pháp của mã nguồn, có thể được thực hiện bởi các lập trình viên do sự thiếu quan tâm hoặc kiến ​​thức của họ. Nó còn được gọi là lỗi phân tích cú pháp. Trình biên dịch được sử dụng để bắt lỗi cú pháp tại thời điểm biên dịch.

Lưu ý: Lỗi cú pháp dừng thực thi mã.

Lỗi cú pháp là một sai lầm trong cú pháp của mã nguồn, có thể được thực hiện bởi các lập trình viên do sự thiếu quan tâm hoặc kiến ​​thức của họ. Nó còn được gọi là lỗi phân tích cú pháp. Trình biên dịch được sử dụng để bắt lỗi cú pháp tại thời điểm biên dịch.

Airtel
Notice: Undefined variable: automobile in C:\xampp\htdocs\program\fatalerror.php on line 6

Lưu ý: Lỗi cú pháp dừng thực thi mã. In this above example, we were trying to use a variable $automobile, which was not defined. Therefore, it generated a notice "Undefined variable" and continued the execution of the program.


Có bao nhiêu mức độ lỗi trong PHP?

Có bao nhiêu mức độ lỗi trong PHP? Có 16 mức độ lỗi trong PHP 5. Các lỗi này đại diện cho danh mục và đôi khi mức độ nghiêm trọng của một lỗi trong PHP. Có rất nhiều, nhưng nhiều loại cho phép bạn dễ dàng xác định nơi gỡ lỗi một lỗi từ cấp độ của nó.

Làm thế nào cho thấy tất cả các lỗi trong PHP?

  • Cách nhanh nhất để hiển thị tất cả các lỗi và cảnh báo PHP là thêm các dòng này vào tệp mã PHP của bạn: ini_set ('display_errors', 1); ini_set ('display_startup_errors', 1); error_Reporting (e_all); Hàm ini_set sẽ cố gắng ghi đè cấu hình được tìm thấy trong PHP của bạn.
  • Xem thảo luận
  • Có bao nhiêu mức độ lỗi trong PHP?

    Có bao nhiêu mức độ lỗi trong PHP? Có 16 mức độ lỗi trong PHP 5. Các lỗi này đại diện cho danh mục và đôi khi mức độ nghiêm trọng của một lỗi trong PHP. Có rất nhiều, nhưng nhiều loại cho phép bạn dễ dàng xác định nơi gỡ lỗi một lỗi từ cấp độ của nó.

    Làm thế nào cho thấy tất cả các lỗi trong PHP?

    Cách nhanh nhất để hiển thị tất cả các lỗi và cảnh báo PHP là thêm các dòng này vào tệp mã PHP của bạn: ini_set ('display_errors', 1); ini_set ('display_startup_errors', 1); error_Reporting (e_all); Hàm ini_set sẽ cố gắng ghi đè cấu hình được tìm thấy trong PHP của bạn.

    Xem thảo luận basically four main type of errors.

    1. Cải thiện bài viết It is the type of error done by the programmer in the source code of the program. The syntax error is caught by the compiler. After fixing the syntax error the compiler compile the code and execute it. Parse errors can be caused dues to unclosed quotes, missing or Extra parentheses, Unclosed braces, Missing semicolon etc
      Example:

      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      0

      Lưu bài viết

      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      5
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      6
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      4

      PHP Fatal error:  Uncaught Error: 
      Call to undefined function diff() 
      in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php:12
      
      Stack trace:
      #0 {main}
        thrown in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php on line 12
      
      7
      PHP Fatal error:  Uncaught Error: 
      Call to undefined function diff() 
      in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php:12
      
      Stack trace:
      #0 {main}
        thrown in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php on line 12
      
      8
      PHP Fatal error:  Uncaught Error: 
      Call to undefined function diff() 
      in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php:12
      
      Stack trace:
      #0 {main}
        thrown in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php on line 12
      
      9
      PHP Parse error:  syntax error, unexpected '=' 
      in /home/18cb2875ac563160a6120819bab084c8.php on line 3
      
      5

      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      8
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      1
      Airtel
      Notice: Undefined variable: automobile in C:\xampp\htdocs\program\fatalerror.php on line 6
      
      3
      PHP Warning:  include(gfg.php): failed to 
      open stream: No such file or directory in 
      /home/aed0ed3b35fece41022f332aba5c9b45.php on line 5
      PHP Warning:  include(): Failed opening 'gfg.php'
       for inclusion (include_path='.:/usr/share/php') in 
      /home/aed0ed3b35fece41022f332aba5c9b45.php on line 5
      
      4
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      4

      Fatal error: Uncaught Error: Call to undefined function catch_fatal_error() in C:\xampp\htdocs\program\fatalerror.php:15 Stack trace: #0 {main} thrown in C:\xampp\htdocs\program\fatalerror.php on line 13
      
      4

      Error:

      PHP Parse error:  syntax error, unexpected '=' 
      in /home/18cb2875ac563160a6120819bab084c8.php on line 3
      

      Giải thích: Chương trình này gọi một tệp không xác định gfg.php không có sẵn. Vì vậy, nó tạo ra lỗi. In above program, $ sign is missing in line 3 so it gives an error message.

    2. Lỗi thông báo: Nó tương tự như lỗi cảnh báo. Điều đó có nghĩa là chương trình chứa sai điều gì đó nhưng nó cho phép thực hiện script.example: It is the type of error where PHP compiler understand the PHP code but it recognizes an undeclared function. This means that function is called without the definition of function.
      Example:

      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      0

      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      8
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      1
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      4

      Warning Error:
      Warning: include(jtp.php): failed to open stream: No such file or directory in C:\xampp\htdocs\program\fatalerror.php on line 7
      
      Warning: include(): Failed opening 'jtp.php' for inclusion (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\program\fatalerror.php on line 7
      
      2

      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      8
      PHP Notice:  Undefined variable: geeks in 
      /home/84c47fe936e1068b69fb834508d59689.php on line 5
      
      6
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      4

      Giải thích: Chương trình này sử dụng biến không được khai báo $ Geek để nó đưa ra thông báo lỗi.

      Airtel
      Notice: Undefined variable: automobile in C:\xampp\htdocs\program\fatalerror.php on line 6
      
      6

      Hằng số lỗi PHP và mô tả của chúng:

      E_error: một lỗi gây tử vong gây ra kết thúc tập lệnh

      E_Warning: Cảnh báo thời gian chạy không gây ra kết thúc tập lệnh

      PHP Parse error:  syntax error, unexpected '=' 
      in /home/18cb2875ac563160a6120819bab084c8.php on line 3
      
      6
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      1
      Fatal error: Uncaught Error: Call to undefined function catch_fatal_error() in C:\xampp\htdocs\program\fatalerror.php:15 Stack trace: #0 {main} thrown in C:\xampp\htdocs\program\fatalerror.php on line 13
      
      9
      Fatal error: Uncaught Error: Call to undefined function catch_fatal_error() in C:\xampp\htdocs\program\fatalerror.php:15 Stack trace: #0 {main} thrown in C:\xampp\htdocs\program\fatalerror.php on line 13
      
      2
      PHP Parse error:  syntax error, unexpected '=' 
      in /home/18cb2875ac563160a6120819bab084c8.php on line 3
      
      5

      Fatal error: Uncaught Error: Call to undefined function catch_fatal_error() in C:\xampp\htdocs\program\fatalerror.php:15 Stack trace: #0 {main} thrown in C:\xampp\htdocs\program\fatalerror.php on line 13
      
      4

      Error:

      PHP Fatal error:  Uncaught Error: 
      Call to undefined function diff() 
      in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php:12
      
      Stack trace:
      #0 {main}
        thrown in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php on line 12
      

      Giải thích: Trong dòng 12, hàm được gọi nhưng định nghĩa về hàm không có sẵn. Vì vậy, nó đưa ra lỗi. In line 12, function is called but the definition of function is not available. So it gives error.

    3. Lỗi cảnh báo: Lý do chính của lỗi cảnh báo là bao gồm một tệp bị thiếu. Điều này có nghĩa là chức năng PHP gọi tệp bị thiếu.example: The main reason of warning errors are including a missing file. This means that the PHP function call the missing file.
      Example:

      PHP Fatal error:  Uncaught Error: 
      Call to undefined function diff() 
      in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php:12
      
      Stack trace:
      #0 {main}
        thrown in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php on line 12
      
      2

      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      1
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      2
      PHP Fatal error:  Uncaught Error: 
      Call to undefined function diff() 
      in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php:12
      
      Stack trace:
      #0 {main}
        thrown in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php on line 12
      
      5
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      4

      PHP Fatal error:  Uncaught Error: 
      Call to undefined function diff() 
      in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php:12
      
      Stack trace:
      #0 {main}
        thrown in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php on line 12
      
      7
      PHP Fatal error:  Uncaught Error: 
      Call to undefined function diff() 
      in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php:12
      
      Stack trace:
      #0 {main}
        thrown in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php on line 12
      
      8
      PHP Fatal error:  Uncaught Error: 
      Call to undefined function diff() 
      in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php:12
      
      Stack trace:
      #0 {main}
        thrown in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php on line 12
      
      9
      PHP Parse error:  syntax error, unexpected '=' 
      in /home/18cb2875ac563160a6120819bab084c8.php on line 3
      
      5

      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      8
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      1
      Airtel
      Notice: Undefined variable: automobile in C:\xampp\htdocs\program\fatalerror.php on line 6
      
      3
      PHP Warning:  include(gfg.php): failed to 
      open stream: No such file or directory in 
      /home/aed0ed3b35fece41022f332aba5c9b45.php on line 5
      PHP Warning:  include(): Failed opening 'gfg.php'
       for inclusion (include_path='.:/usr/share/php') in 
      /home/aed0ed3b35fece41022f332aba5c9b45.php on line 5
      
      4
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      4

      Fatal error: Uncaught Error: Call to undefined function catch_fatal_error() in C:\xampp\htdocs\program\fatalerror.php:15 Stack trace: #0 {main} thrown in C:\xampp\htdocs\program\fatalerror.php on line 13
      
      4

      Error:

      PHP Warning:  include(gfg.php): failed to 
      open stream: No such file or directory in 
      /home/aed0ed3b35fece41022f332aba5c9b45.php on line 5
      PHP Warning:  include(): Failed opening 'gfg.php'
       for inclusion (include_path='.:/usr/share/php') in 
      /home/aed0ed3b35fece41022f332aba5c9b45.php on line 5
      

      Giải thích: Chương trình này gọi một tệp không xác định gfg.php không có sẵn. Vì vậy, nó tạo ra lỗi. This program call an undefined file gfg.php which are not available. So it produces error.

    4. Lỗi thông báo: Nó tương tự như lỗi cảnh báo. Điều đó có nghĩa là chương trình chứa sai điều gì đó nhưng nó cho phép thực hiện script.example: It is similar to warning error. It means that the program contains something wrong but it allows the execution of script.
      Example:

      PHP Fatal error:  Uncaught Error: 
      Call to undefined function diff() 
      in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php:12
      
      Stack trace:
      #0 {main}
        thrown in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php on line 12
      
      2

      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      1
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      2
      PHP Fatal error:  Uncaught Error: 
      Call to undefined function diff() 
      in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php:12
      
      Stack trace:
      #0 {main}
        thrown in /home/36db1ad4634ff7deb7f7347a4ac14d3a.php on line 12
      
      5
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      4

      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      8
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      1
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      4

      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      8
      PHP Notice:  Undefined variable: geeks in 
      /home/84c47fe936e1068b69fb834508d59689.php on line 5
      
      6
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      4

      Fatal error: Uncaught Error: Call to undefined function catch_fatal_error() in C:\xampp\htdocs\program\fatalerror.php:15 Stack trace: #0 {main} thrown in C:\xampp\htdocs\program\fatalerror.php on line 13
      
      4

      Error:

      PHP Notice:  Undefined variable: geeks in 
      /home/84c47fe936e1068b69fb834508d59689.php on line 5
      

      Output:

      GeeksforGeeks
      

      Giải thích: Chương trình này sử dụng biến không được khai báo $ Geek để nó đưa ra thông báo lỗi. This program use undeclared variable $geeks so it gives error message.

    Hằng số lỗi PHP và mô tả của chúng:

    • E_error: một lỗi gây tử vong gây ra kết thúc tập lệnh A fatal error that causes script termination
    • E_Warning: Cảnh báo thời gian chạy không gây ra kết thúc tập lệnh Run-time warning that does not cause script termination
    • E_Parse: Biên dịch lỗi phân tích thời gian. Compile time parse error.
    • E_notice: Chạy thông báo thời gian gây ra do lỗi trong mãRun time notice caused due to error in code
    • E_CORE_ERROR: Lỗi nghiêm trọng xảy ra trong quá trình khởi động ban đầu của PHP (Cài đặt)Fatal errors that occur during PHP’s initial startup (installation)
    • E_core_warning: cảnh báo xảy ra trong khi khởi động ban đầu của PHPWarnings that occur during PHP’s initial startup
    • E_Compile_error: Lỗi thời gian biên dịch gây tử vong Vấn đề chỉ định với tập lệnh. Fatal compile-time errors indication problem with script.
    • E_USER_ERROR: Thông báo lỗi do người dùng tạo. User-generated error message.
    • E_USER_WARNING: Thông báo cảnh báo do người dùng tạo. User-generated warning message.
    • E_USER_NOTICE: Thông báo thông báo do người dùng tạo. User-generated notice message.
    • E_Strict: Thông báo thời gian chạy. Run-time notices.
    • E_RECOVERABLE_ERROR: Lỗi nghiêm trọng có thể bắt được cho thấy lỗi nguy hiểm Catchable fatal error indicating a dangerous error
    • E_Deprecated: Thông báo thời gian chạy. Run-time notices.

    Các loại lỗi khác nhau là gì?

    Có ba loại lỗi: có hệ thống, ngẫu nhiên và lỗi của con người.systematic, random, and human error.

    Lỗi giải thích các loại lỗi khác nhau với ví dụ trong PHP là gì?

    Về cơ bản, một lỗi là một sai lầm trong một chương trình có thể được gây ra bằng cách viết cú pháp không chính xác hoặc mã không chính xác.Một thông báo lỗi được hiển thị trên trình duyệt của bạn chứa tên tệp cùng với vị trí, một thông báo mô tả lỗi và số dòng trong đó xảy ra lỗi.a mistake in a program that may be caused by writing incorrect syntax or incorrect code. An error message is displayed on your browser containing the filename along with location, a message describing the error, and the line number in which error has occurred.

    Có bao nhiêu mức độ lỗi trong PHP?

    Có bao nhiêu mức độ lỗi trong PHP?Có 16 mức độ lỗi trong PHP 5. Các lỗi này đại diện cho danh mục và đôi khi mức độ nghiêm trọng của một lỗi trong PHP.Có rất nhiều, nhưng nhiều loại cho phép bạn dễ dàng xác định nơi gỡ lỗi một lỗi từ cấp độ của nó.16 error levels in PHP 5. These errors represent the category and sometimes severity of an error in PHP. There are a lot, but the numerous categories let you easily identify where to debug an error from its level alone.

    Làm thế nào cho thấy tất cả các lỗi trong PHP?

    Cách nhanh nhất để hiển thị tất cả các lỗi và cảnh báo PHP là thêm các dòng này vào tệp mã PHP của bạn: ini_set ('display_errors', 1);ini_set ('display_startup_errors', 1);error_Reporting (e_all);Hàm ini_set sẽ cố gắng ghi đè cấu hình được tìm thấy trong PHP của bạn.ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); The ini_set function will try to override the configuration found in your php.