PHPÖйØÓÚutf
Ò».HTMLÒ³ÃæתUTF-8±àÂëÎÊÌâ
1.ÔÚ<head>ºó£¬<title>Ç°¼ÓÈëÒ»ÐУº
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
˳Ðò²»ÄÜ´í£¬Ò»¶¨ÒªÔÚ<title>±êÇ©Ç°¼ÓÈ룬·ñÔòÈç¹û<title>Óë</title>Ö®¼äÓÐÖÐÎÄ×Ö·ûµÄ»°£¬
ÏÔʾµÄ±êÌâÓпÉÄÜÊÇÂÒÂ룡
2.htmlÎļþ±àÂëÎÊÌâ:
±¾²¿·ÖÉ趨ÁËÒþ²Ø,ÄúÒѻظ´¹ýÁË,ÒÔÏÂÊÇÒþ²ØµÄÄÚÈÝ
µã»÷±à¼Æ÷µÄ²Ëµ¥£º“Îļþ”->“Áí´æΪ”£¬¿ÉÒÔ¿´µ½µ±Ç°ÎļþµÄ±àÂ룬ȷ±£Îļþ±àÂëΪ£ºUTF-8£¬
Èç¹ûÊÇANSI£¬ÐèÒª½«±àÂë¸Ä³É£ºUTF-8¡£
3.HTMLÎļþÍ·BOMÎÊÌ⣺
½«Îļþ´ÓÆäËûµÄ±àÂëת»»³ÉUTF-8±àÂëʱ£¬ÓÐʱºò»áÔÚÎļþµÄ×ʼ¼ÓÉÏÒ»¸öBOM±êÇ©£¬
ÔÚ¸öBOM±êÇ©¿ÉÄܻᵼÖÂä¯ÀÀÆ÷ÔÚÏÔʾÖÐÎĵÄʱºò³öÏÖÂÒÂë¡£
ɾ³ýÕâ¸öBOM±êÇ©µÄ·½·¨£º
1.¿ÉÒÔÓÃDreamweaver´ò¿ªÎļþ£¬²¢ÖØб£´æ£¬¼´¿ÉÒÔÈ¥³ýBOM±êÇ©£¡
2.¿ÉÒÔÓÃEditPlus´ò¿ªÎļþ£¬²¢Ôڲ˵¥“Ê×Ñ¡Ïî”->“Îļþ”->"UTF-8±êʶ"£¬ÉèÖÃΪ£º“×ÜÊÇɾ³ýÇ©Ãû”£¬
È»ºó±£´æÎļþ£¬¼´¿ÉÒÔÈ¥³ýBOM±êÇ©£¡
4.WEB·þÎñÆ÷UTF-8±àÂëÎÊÌ⣺
Èç¹ûÄã°´ÒÔÉÏËùÁеIJ½Öè×öÁË£¬»¹ÊÇÓÐÖÐÎÄÂÒÂëÎÊÌ⣬
Çë¼ì²éÄãµÄËùʹÓõÄWEB·þÎñÆ÷µÄ±àÂëÎÊÌâ
Èç¹ûÄãʹÓõÄÊÇApache£¬Ç뽫ÅäÖÃÎļþÀïµÄ£ºcharset Éè³É£ºutf-8(ÕâÀï½öÁгö·½·¨£¬¾ßÌå¸ñʽÇë²Î¿¼apacheµÄÅäÖÃÎļþ)
Èç¹ûÄãʹÓõÄÊÇNginx£¬Ç뽫nginx.confÀïµÄ£ºcharset Éè³É utf-8£¬
¾ßÌåÕÒµ½ "charset gb2312;"»òÕßÀàËƵÄÓï¾ä£¬¸Ä³É£º“charset utf-8;”¡£
--------------------------------------------------------------------------------
¶þ.PHPÒ³ÃæתUTF-8±àÂëÎÊÌâ
1.ÔÚ´úÂ뿪ʼ³ö¼ÓÈëÒ»ÐУº
header("Content-Type: text/html;charset=utf-8");
2.PHPÎļþ±àÂëÎÊÌâ
±¾²¿·ÖÉ趨ÁËÒþ²Ø,ÄúÒѻظ´¹ýÁË,ÒÔÏÂÊÇÒþ²ØµÄÄÚÈÝ
µã»÷±à¼Æ÷µÄ²Ëµ¥£º“Îļþ”->“Áí´æΪ”£¬¿ÉÒÔ¿´µ½µ±Ç°ÎļþµÄ±àÂ룬ȷ±£Îļþ±àÂëΪ£ºUTF-8£¬
Èç¹ûÊÇANSI£¬ÐèÒª½«±àÂë¸Ä³É£ºUTF-8¡£
3.PHPÎļþÍ·BOMÎÊÌ⣺
PHPÎļþÒ»¶¨²»¿ÉÒÔÓÐBOM±êÇ©
·ñÔò£¬»á³öÏÖsession²»ÄÜʹÓõÄÇé¿ö£¬²¢ÓÐÀàËƵÄÌáʾ£º
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent
ÕâÊÇÒòΪ£¬ÔÚÖ´ÐÐsession_start() µÄÊ
Ïà¹ØÎĵµ£º
ÔÀ´ÊÇѧjspµÄ£¬µ«ÊǸоõjspÌ«ÄÑÁË£¬¶øÇÒ·¢ÏÖ£¬ÏÖÔڱȽÏÁ÷ÐÐphpÁË£¬php+mysqlµÄ»Æ½ð´îµµ¡£
¿´jspµÄÊéʱ£¬ÊéÉÏ˵£¬jsp±ÈphpºÃ£¬ÏÖÔÚ¿´phpµÄÊ飬˵php±ÈjspºÃ£¬ÎÒÏëÕâÒ²ÊÇÖÇÕß¼ûÖÇ£¬ÈÊÕß¼ûÈÊ°É¡£
ÇìÐÒ×Ô¼ºÑ§php·¢ÏÖÁËÒ»±¾ºÃÊ飬ÍƼö¸ø´ó¼Ò£¬¾ÍÊǽ²µÄºÜÏêϸ¡£
Ó¢ÎÄÃû¡¶PHP and MySQL EXAMPLE¡· ÃÀ¹ ......
1.·½·¨Ò»£º
<?
$dir="D:";
static $dir_list =0;
static $file_list =0;
function listfile($dir){
global $dir_list,$file_list;
$d = dir($dir);
while ( $entry = $d->read()) {
$tem_curnt=$dir."/".$entry;
if($entry=="." || $entry=="..") continue;
if ( is_dir( $tem_curnt)) {
......
×î½üÎҵļ¸ÆªÎÄÕ¶¼ÊÇÊÇ×î½üÏîÄ¿µÄÒ»µãÐĵÃ^^
Õâ¸öÏîÄ¿Ò»¿ªÊ¼¾ÍÉè¼ÆµÄ“ºÜ´ó”£¬¿¼ÂÇÁ˺ฺܶÔؾùºâ·½ÃæµÄ¶«Î÷£¬±ÈÈç²ÉÓÃnginx½«phpµÄÇëÇó·Ö̯µ½Èô¸É¸öÔËÐÐphp fastcgiµÄ¶ÀÁ¢·þÎñÆ÷ÖС£ÕâÑùµÄÉè¼Æ³ýÁËÔÚÿ¸öphp fastcgi·þÎñÆ÷ÖÐÒª±£´æÒ»·Ý³ÌÐòµÄ¿½±´ÒÔÍ⣬»¹ÓÐÒ»¸öؽ´ý½â¾öµÄÎÊÌâ¡£ÓÉÓÚphp fastcgi½ø³Ì·Ö±ðÔËÐÐÔ ......
<?php
// An array of allowed users and their passwords
$users = array(
'harryf' => 'secret',
'tom' => 'mypwd'
);
// If there's no Authentication header, exit
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic real ......
ʹÓõÄÊÇADODB¿â,ÐèÒªÓÐOCI8¿â.
<?php
//require("adodb5/adodb-exceptions.inc.php");
require("adodb5/adodb.inc.php");
$conn = NewADOConnection("oci8");
$conn->Connect($url, $user, $password, $service_name);
$rs;
try {
$rs = $conn->Execu ......