I read the blog of "ljianhui's column" (http://blog.csdn.net/ljianhui/article/details/17341219) today. There are a few words that I agree with very much. "Writing code is the same as writing articles. Express your own ideas clearly. "So, writing code also requires clear thinking and understanding!
Recently, I have been crazy about improving my technical skills. I graduated last year. After graduation last year, I spent five months taking the postgraduate entrance examination and failed to pass it, which made my skills a little behind. I still have very little experience in truly down-to-earth work, especially working in an excellent team. Because of my lack of solid skills, I suffered a lot in technology a while ago. So, I made up my mind to improve my skills. To be honest, I'm not very obsessed with technology, but since I'm in this business, let's do something about it! I believe that interest is cultivated. No one is interested from birth. It still depends on guidance and discovery of points of interest.
There are a lot of things to learn now, including PHP, js, linux, mysql, distribution, and caching. . . , Everything depends on accumulation, so work hard.
Okay, stop talking nonsense all the time and write something real.
Today I learned the error handling mechanism of PHP and the basic commands of Linux.
My understanding of error handling is: when writing code, you must consider the integrity and security of the code. The error handling mechanism is to avoid errors and to take remedial measures after errors do occur. A brief introduction to the error handling mechanism of PHP is as follows. Partial reference is http://php.net/manual/zh/book.errorfunc.php:
1: About the triggering, display and processing of errors.
1. First, you can configure the error reporting level of error_reporting through the configuration file in php.ini. The error level can also be set in the server configuration file and PHP code.
2. Users can generate a user-level error, notice or warning message through trigger_error().
3. User-defined error handling function can be set through the set_error_handler() function.
Two: About throwing and catching exceptions.
1. Here is what I excerpted from the book: "Exceptions provide a unified mechanism for handling errors in a scalable, maintainable, and object-oriented way."
2.Exception handling is the try...throw...catch statement, which sets special strategies and different code paths for abnormal situations that may be encountered. For example, when you think that a piece of code or a function may cause an error, you can put the piece of code or function in the try{} code block, and if an error occurs, manually throw an object in try{}, and then This exception is caught through catch after the try statement. Multiple catch statements can be set up to catch different types of exceptions and handle them accordingly.
3.throw can throw any type of exception object, but it is recommended to use an instance of the Exception class or an instance of the exception class inherited from her. If you don’t understand some of the things mentioned above, you can go to Baidu or Bing, and I won’t go into details here.
2. User-defined Exception handling function can be set through set_Exception_handler, which is used to handle exceptions without try/catch.
Here, I don’t have a deep understanding of Exception handling and error handling. I’m sorry, but please give me some advice. Because it’s past twelve o’clock and I have to get up early tomorrow, I don’t have much time to elaborate. I will definitely elaborate on these things again in the future. Now I feel that even one error handling in PHP is profound. Haha, it’s just me. Are you ignorant?
The above has introduced that good programmers are good writers, including Exception, exception handling, and object-oriented content. I hope it will be helpful to friends who are interested in PHP tutorials.