PHP header() examples
//ÓÃÕâ¸öheaderÖ¸ÁîÀ´½â¾öURLÖØÐ´²úÉúµÄ404 header
header('HTTP/1.1 200 OK');
// Ò³ÃæÃ»ÕÒµ½
header('HTTP/1.1 404 Not Found');
// ·ÃÎÊÊÜÏÞ
header('HTTP/1.1 403 Forbidden');
// The page moved permanently should be used for
// all redrictions, because search engines know
// what's going on and can easily update their urls.
//Ò³Ãæ±»ÓÀ¾Ãɾ³ý£¬¿ÉÒÔ¸æËßËÑË÷ÒýÇæ¸üÐÂËüÃǵÄurls
//PS:µÚÒ»´ÎÅöµ½Õâ¸öÖ¸Á²»ÖªµÀÄܲ»ÄÜÓÃÀ´°Ñ×Ô¼ºµÄÕ¾µã´ÓËÑË÷ÒýÇæÖÐɾ³ýÄØ£¿
header('HTTP/1.1 301 Moved Permanently');
// ·þÎñÆ÷´íÎó
header('HTTP/1.1 500 Internal Server Error');
// ÖØ¶¨Ïòµ½Ò»¸öеÄλÖÃ
header('Location: http://www.example.org/');
// ÑÓ³ÙÒ»¶Îʱ¼äºóÖØ¶¨Ïò
header('Refresh: 10; url=http://www.example.org/');
print 'You will be redirected in 10 seconds';
// Ò²¿ÉÒÔʹÓÃHTMLÓï·¨À´ÊµÏÖÑÓ³Ù
// zip"');
header('Content-Transfer-Encoding: binary');
// ¼ÓÔØÒªÏÂÔØµÄÎļþ:
readfile('example.zip');
// ½ûÖ¹»º´æµ±Ç°Îĵµ:&n
Ïà¹ØÎĵµ£º
phpÖÐÈÕÆÚת»»º¯ÊýstrtotimeµÄÓ÷¨:
Óï·¨:
int strtotime ( string time [, int now] )
·µ»Ø½«ÈκÎÓ¢ÎÄÎı¾µÄÈÕÆÚʱ¼äÃèÊö½âÎöΪ Unix ʱ¼ä´Á
ʵÀý:
Ò»£¬»ñȡָ¶¨ÈÕÆÚµÄunixʱ¼ä´Á strtotime("2009-1-22") ʾÀýÈçÏ£º
echo strtotime("2009-1-22") ½á¹û£º1232553600
˵Ã÷£º·µ»Ø2009Äê1ÔÂ22ÈÕ0µã ......
×¢Ò⣺֮ǰÎÒÔÚÍøÉÏÕÒÁ˺öàµÄ×ÊÁÏ NND¶¼²»ÄÜÕý³£ÅäÖóɹ¦ ¸ãµÃÎÒÊǷdz£µØÓôÃÆ£¡
ÕÒµ½ÕâÆªÎÄÕÂÖ®ºóÎÒÖÕÓÚÅäÖóɹ¦ÁË£¡ÍÛºÃˬѽ£¡Ö»Òª°´ÕÕ ÉÏÃæµÄ²½Öè¾ÍÒ»¶¨Äܹ»³É¹¦µÄ£¡
´ËÎÄյݲװ·½·¨ÊÊÓÃÓÚWindows XPϵÄApache+PHP+MySQL°²×°£¬Í¬Ê±Ò²ÊÊÓÃÓÚWindows 2003ϵͳϵݲװºÍÅäÖá£
1. °²×°»·¾³
²Ù×÷ϵͳÊÇ Window ......
Ò».HTMLÒ³Ãæ×ªUTF-8±àÂëÎÊÌâ
1.ÔÚ<head>ºó£¬<title>ǰ¼ÓÈëÒ»ÐУº
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
˳Ðò²»ÄÜ´í£¬Ò»¶¨ÒªÔÚ<title>±êǩǰ¼ÓÈ룬·ñÔòÈç¹û<title>Óë</title>Ö®¼äÓÐÖÐÎÄ×Ö·ûµÄ»°£¬
ÏÔʾµÄ±êÌâÓпÉÄÜÊÇÂÒÂ룡
2.htmlÎ ......
<?
require ("config.php3");
?>
<?
if($submit)
{
//echo $action;
//if($action=='update') &nb ......
ÔÚPHP.netµÄÅ£È˻ظ´ÖÐÕÒµ½Ò»¸ö×Ô¶¯¸ù¾ÝͼƬÎļþÀàÐÍ´ò¿ªÍ¼Æ¬µÄPHPº¯Êý,ºÜ·½±ã.
/**
*
* Loads a file based on its filetype and returns false if it fails.
*/
function imagecreatefromfile($path, $user_functions = false)
{
$info = @getimagesize($path);
if(!$info)
{ ......