phpÖÐfopen²»ÄÜ´´½¨ÖÐÎÄÎļþÃûÎļþµÄÎÊÌâ
֮ǰÍøÒ³µÄchartsetÓõÄÊÇutf-8£¬ÎļþÒ²ÓÃutf-8£¬È»ºóÓÃfopen()´´½¨Ò»¸öÖÐÎÄÎļþÃûµÄÎļþʱÎÊÌâ¾Í³öÀ´ÁË£¬ÎļþÃû¶¼ÊÇÂÒ
Â룡
²é¿´Á˺ܶàÎĵµÊÔÁ˲»ÉÙ·½·¨¶¼½â¾ö²»ÁË£¬±¾À´Ïë×ÅÓñðµÄ·½·¨ÈƹýÕâ¸öÎÊÌ⣬ºöÈ»ÄÔ×ÓÀïÉÁ¹ýWindowsĬÈϵÄÎÄ×Ö±àÂëÊÇansi£¬È»ºóÔÙ
baiduÁËһϣ¬Ö¤ÊµÁËÕâµã£¬ËùÒÔÎÒµÄÍøÒ³Ò²Ó¦¸ÃÊÇansi±àÂë²ÅÄÜʹ´´½¨µÄÎļþÃû²»»áÊÇÂÒÂë¡£
½ÓמÍ×ÅÊÖÑéÖ¤£¬°ÑÍøÒ³¶¼ÓÃansi±£´æ£¬È¥µôchartsetÓï¾ä£¬¹ûÈ»okÁË£¬µ«ÊÇÍøÒ³µÄÄÚÈݾͳÉÂÒÂëÁË£¬ºóÀ´ÏëÆð£¬Õâ¸öÍøÒ³»¹include
Á˱ðµÄÍøÒ³£¬°ÑincludeµÄÍøÒ³Ò²¸Ä³Éansi±£´æ£¬¹þ¹þÍòÊÂok
±à³ÌÕâ¸ö¹¤×÷ÕæµÄºÜ¿¿»ýÀÛ£¬Èç¹ûÎÒÒÔǰû¿´¹ýWindowsĬÈϱàÂëÊÇansi£¬ÄÇÕâ¸öÎÊÌâ¾Í²»ÖªºÎÄêºÎÔ²ÅÄܽâ¾öÁË
ps:<
meta
content
="text/html;
charset=utf-8"
http
-equiv
="Content-type"
>
Õâ¸ömeta±ê¼ÇÒ»¶¨Òª·ÅÔÚ<title></title>֮ǰ²ÅÓÐЧµÄ
ºóÀ´ÓÖÏëµ½ÁËÒ»¸ö¸üºÃµÄ½â¾ö·½·¨£¬ÍøÒ³»¹ÊÇÓÃutf-8±àÂëºÍ±£´æ£¬Ö»ÊÇfopen£¨£©ÀïµÄÎļþÃû²Î
Êýµ¥¶À¸øËü±àÏÂÂë¾ÍÐУ¬phpÓÐiconv£¨£©
Õâ¸ö¸Ä»»±àÂëµÄ³ÌÐò£¬°Ñutf-8ת³É
gb2312¾Í¿ÉÒÔ±ÜÃâÖÐÎÄÎļþÃûΪÂÒÂëÁË
==================================
test.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>±êÌ⣺{title}</title>
</head>
<body>
<b>´ËÐÂÎŵÄÄÚÈÝ£º</b>{content}
</body>
</html>
test.php
<?php
//ʵ¼ÊÓ¦ÓÃÖкܿÉÄÜÊDzéѯÊý¾Ý¿âÈ¡ÄÚÈÝ¡£
$rows = array(array("Ìæ»»±êÌâ1","Ìæ»»ÄÚÈÝ1"),array("Ìæ»»±êÌâ2","Ìæ»»ÄÚÈÝ2"));
$filename = "tmp.htm";
foreach($rows as $id => $val){
$title = $val[0];
$content = $val[1];
$pagename = "²âÊÔ".$id.".html";
//¶ÔÎļþÃûµÄ±àÂë
Ïà¹ØÎĵµ£º
ÏÖÔÚÖ÷Á÷µÄÍøÕ¾¿ª·¢ÓïÑÔÎÞÍâºõasp¡¢php¡¢asp.net¡¢jspµÈ¡£
ÍøÒ³´Ó¿ªÊ¼¼òµ¥µÄhmtlµ½¸´ÔӵķþÎñÓïÑÔ£¬×ß¹ýÁË10¶à¸öÄêÍ·£¬¸÷ÖÖ¼¼Êõ²ã³ö²»Çµ¥¸öµÄÖ÷Á÷¼¼ÊõÒ²ÔÚ²»¶Ï·Ðµİ汾£¬ÏÖÔÚ·ÖÎöϸ÷ÖÖÓïÑÔµÄÇø±ð¡¢ÓÅÊÆ¡¢ÁÓÊÆ¡¢¿ª·¢×¢ÒâÊÂÏ
HTML:µ±È»ÕâÊÇÍøÒ³×î»ù±¾µÄÓïÑÔ,ÿһ¸ö·þÎñÆ÷ÓïÑÔ¶¼ÐèÒªËüµÄÖ§³Ö,Ҫѧϰ,Õâ¸ö¿Ï¶¨ÊÇ¿ªÊ¼ ......
ÔÚÍùPHP SessionÀïÃæ±£´æÐÅϢ֮ǰ£¬ÐèÒªÊ×ÏÈʹÓÃsession_start()º¯ÊýÀ´Æô¶¯session,
Õâ¸öº¯Êý±ØÐëÔÚ<html>±êǩ֮ǰµ÷ÓᣴúÂëÈçÏ£º
<?php session_start(); ?>
<html>
<body>
</body>
</html>
ÔÚSessionÆô¶¯ÒԺ󣬿ÉÒÔʹÓÃPHP $_SESSION±äÁ¿À´»ñÈ¡ºÍÉèÖÃsession±äÁ¿£¬ÊµÀý´ú ......
ÓÃPHPʵÏÖ¼òµ¥µÄÊý¾Ýץȡ
·½·¨Ò»£º
<?php
$urlstr = file_get_contents("http://www.baidu.com");
$urlstr = htmlspecialchars($urlstr);
print_r($urlstr);
?>
·½·¨¶þ£º£¨ÐèÒª´ò¿ªcurlÀ©Õ¹£©
×¢Ò⣺´ò¿ªcurlÀ©Õ¹Ê±£¬Ò»¶¨Òª¿´¿ ......
2008 Äê 11 ÔÂ 17 ÈÕ
Èç¹ûÄúÉÐδ´òËãÓà OO ÔÔò´´½¨Ó¦ÓóÌÐò£¬ÔòʹÓà PHP µÄÃæÏò¶ÔÏó£¨OO£©µÄÓïÑÔÌØÐÔ£¬Õâ 7 ¸öÏ°¹ß½«°ïÖúÄú¿ªÊ¼ÔÚ¹ý³Ì±à³ÌÓë OO ±à³ÌÖ®¼ä½øÐÐת»»¡£
ÔÚ PHP ±à³ÌÔçÆÚ£¬PHP ´úÂëÔÚ±¾ÖÊÉÏÊÇÏÞÓÚÃæÏò¹ý³ÌµÄ¡£¹ý³Ì´úÂë µÄÌØÕ÷ÔÚÓÚʹÓùý³Ì¹¹½¨Ó¦ÓóÌÐò¿é¡£¹ý³Ìͨ¹ýÔÊÐí¹ý³ÌÖ®¼äµÄµ÷ÓÃÌṩijÖ̶ֳȵÄÖØÓá£
µ ......
¹ØÓÚÔÚAJAXÖÐGET»ØµÄResponseTextÖÐÎÄÂÒÂëµÄ×î¼ò½â¾ö°ì·¨
//Èç¹û´«ËͲÎÊýÊÇÖ±½Ó¸³ÓèµÄ£¬¾Í»á²úÉúÂÒÂë!
´úÂëÈçÏÂ:
http_request.open("POST",url,true);
http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http_request.send("action="+strName+"&val="+val); //Èç¹ûvalµÄ ......