Hướng dẫn how many types of errors are there in php? - Có bao nhiêu loại lỗi trong php?

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.


Xem thảo luận

Cải thiện bài viết

Lưu bài viết

  • Đọc
  • Bàn luận
  • Xem thảo luận

    Cải thiện bài viết

    Lưu bài viết

    Đọc

    Bàn luận basically four main type of errors.

    1. Lỗi là lỗi hoặc sai lầm trong một chương trình. Nó có thể là một số loại. Lỗi có thể xảy ra do cú pháp sai hoặc logic sai. Đó là một loại sai lầm hoặc điều kiện có kiến ​​thức không chính xác về mã. 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

      Có nhiều loại lỗi khác nhau trong PHP nhưng về cơ bản nó chứa bốn loại lỗi chính.

      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

      Lỗi phân tích hoặc lỗi cú pháp: Đây là loại lỗi được thực hiện bởi lập trình viên trong mã nguồn của chương trình. Lỗi cú pháp bị bắt bởi trình biên dịch. Sau khi sửa lỗi cú pháp, trình biên dịch biên dịch mã và thực thi nó. Lỗi phân tích cú pháp có thể được khiến các khoản phí không được trích dẫn, thiếu hoặc thêm dấu ngoặc đơn, niềng răng không bị thiếu, thiếu hụt Etcexample:

      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
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      3
      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
      

      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
      In above program, $ sign is missing in line 3 so it gives an error message.

    2. Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      8
      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
      
      22
      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

      Giải thích: Trong chương trình trên, $ Sign bị thiếu trong dòng 3 vì vậy nó cung cấp một thông báo lỗi.

      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

      Lỗi nghiêm trọng: Đây là loại lỗi trong đó trình biên dịch PHP hiểu mã PHP nhưng nó nhận ra hàm không được khai báo. Điều này có nghĩa là chức năng được gọi mà không có định nghĩa về chức năng.example:

      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
      
      6
      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
      
      7
      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
      
      2222

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

      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
      
      3
      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
      
      4
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      2
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      1
      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
      
      7
      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
      
      222

      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
      
      3
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      8
      Airtel
      Notice: Undefined variable: automobile in C:\xampp\htdocs\program\fatalerror.php on line 6
      
      2
      Airtel
      Notice: Undefined variable: automobile in C:\xampp\htdocs\program\fatalerror.php on line 6
      
      3
      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
      
      4
      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
      
      1
      Airtel
      Notice: Undefined variable: automobile in C:\xampp\htdocs\program\fatalerror.php on line 6
      
      8

      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
      

      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
      
      0
      In line 12, function is called but the definition of function is not available. So it gives error.

    3. 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
      
      7
      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
      
      222
      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

      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.

      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:

      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

      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
      

      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
      This program call an undefined file gfg.php which are not available. So it produces error.

    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
      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
      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

      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.

      Lỗi phân tích hoặc lỗi cú pháp: Đây là loại lỗi được thực hiện bởi lập trình viên trong mã nguồn của chương trình. Lỗi cú pháp bị bắt bởi trình biên dịch. Sau khi sửa lỗi cú pháp, trình biên dịch biên dịch mã và thực thi nó. Lỗi phân tích cú pháp có thể được khiến các khoản phí không được trích dẫn, thiếu hoặc thêm dấu ngoặc đơn, niềng răng không bị thiếu, thiếu hụt Etcexample:

      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
      Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\program\fatalerror.php on line 5
      
      3
      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
      

      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
      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 chính trong PHP là gì?

    Trong PHP, chủ yếu là bốn loại lỗi được xem xét:..
    Lỗi cú pháp hoặc lỗi phân tích cú pháp ..
    Lỗi nghiêm trọng..
    Lỗi cảnh báo ..
    Thông báo lỗi ..

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

    Có ba loại lỗi được phân loại dựa trên nguồn mà chúng phát sinh;Đó là: Lỗi gộp.Lỗi ngẫu nhiên.Lỗi hệ thống.Gross Errors. Random Errors. Systematic Errors.

    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.