Usually, when judging a non-existing resource (such as category or product does not exist) through php, you need to return a 404 status through the header and display the corresponding 404 page. the method on the previous server is as follows: header (#3... usually, when judging a non-existing resource (such as category or product does not exist) through php, you need to return a 404 status through the header and display the corresponding 404 page. the method on the previous server is as follows:
Header ('http/1.1 404 Not Found '); header ('status: 404 Not Found'); require ('404. php'); exit ();
However, after a new server is changed, it finds that some letters and numbers are garbled on the page. after checking, it is found that the communication protocol version is inconsistent with HTTP/1.1 in the code when the current server request page is displayed, to know the name and version of the communication PROTOCOL of the current server, use $ _ SERVER ['server _ protocol']. after testing, the http version of my SERVER is 1.0, so the code should be changed:
Header ('http/1.0 404 Not Found '); header ('status: 404 Not Found'); require ('error. php'); exit ();
Article URL:
Reprint ^ at will, but please attach the tutorial address.