: This article mainly introduces PHP404 judgment and js404 judgment. if you are interested in the PHP Tutorial, please refer to it.
PHP 404 judgment and js 404 judgment
Php judges 404:
$ Url = home_url (). "/wp-content/themes/twentythirteen/pic /". $ result ['Pic ']; $ headers = @ get_headers ($ url); if (strpos ($ headers [0], '123 ')) {$ url = home_url (). "/wp-content/themes/twentythirteen/pic/default.png ";}
Js judges 404:
Var pic_url = "/wp-content/themes/twentythirteen/pic/" + data [I]. pic; $. ajax ({url: pic_url, error: function (xhr, error, ex) {if (xhr. status = '000000') {pic_url = "/wp-content/themes/twentythirteen/pic/default.png" ;}}, success: function () {pic_url = pic_url ;}});
Js judges 404, through ajax ......
The above describes PHP 404 judgment and js 404 judgment, including the content. For more information, see PHP Chinese website (www.php1.cn )!