PHP has been written for a while. There are not many codes, but we have encountered some intractable diseases. This is the first article, which is saved for a long time and updated for a long time to feed the latter.
1. After PHP outputs anything, it cannot plant cookies or header (location :'');
Don't worry, where is var_dump ()? I will handle it myself.
What about utf8bom? So when writing your PHP code, notepad ++ please be sure to use "UTF-8 without BOM format encoding ";
When your code is finally written, enter it with satisfaction. '?> ', Make sure there is no carriage return. In some cases, include will introduce '?> 'Cannot contain cookies. Therefore, we recommend that you open the header in a file '<? PHP ', J does not end with'?> '
The end mark of the PHP code segment at the end of the {Ref: PhP manual} file may not be required. In some cases, it would be better to omit it when using include () or require, in this way, unexpected white spaces will not appear at the end of the file, and the response header can still be output later. It is also convenient to use the output buffer, so you will not see unexpected white spaces generated by the contained files.
2. Fatal error: Can't use method return value in write context in/data/www/test_controller.php
This error occurs when I use empty ($ this-> function (). It mainly means that parameters in the empty () function cannot be returned by other methods.
3. What cookies are used in PHP to obtain cookies?
The cookie in one request cannot be obtained through $ _ cookie in the grade request. The cookie can be obtained only after the next request.
4. header ("Location: http: // your_addresss ");
After the header ("Location: XXXX") is executed, exit is generally added. Otherwise, the code below this sentence will continue to be executed. Of course, you have special requirements. For example, if an error occurs, you can use the header to jump to the error page and then perform some asynchronous error handling procedures.