php¶ÁÊý¾Ý¿âÂÒÂë
<?php
// Á¬½Ó£¬Ñ¡ÔñÊý¾Ý¿â
$dbconn = pg_connect("host=localhost dbname=publishing user=www password=foo")
or die('Could not connect: ' . pg_last_error());
// Ö´ÐÐ SQL ²éѯ
$query = 'SELECT * from authors';
$result = pg_query($query) or die('Query failed: ' . pg_last_error());
// Óà HTML ÏÔʾ½á¹û
echo "<table>\n";
while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";
// ÊͷŽá¹û¼¯
pg_free_result($result);
// ¹Ø±ÕÁ¬½Ó
pg_close($dbconn);
?>
http://php.chinaunix.net/manual/zh/ref.pgsql.php
ps:Ò³ÃæÉêÃ÷±àÂ룺ÔÚHTML´úÂëHEADÀïÃæ£¬¿ÉÒÔÓÃ<meta http-equiv="Content-Type" content="text/html;
charset="XXX" />À´¸æËßä¯ÀÀÆ÷ÍøÒ³²ÉÓÃÁËʲô±àÂ룬ĿǰÖÐÎÄÍøÕ¾¿ª·¢ÖÐÖ÷ÒªÓõÄÊÇGB2312ºÍUTF-8Á½ÖÖ±à
Âë¡£
ÌáÈ¡µÄÊý¾Ý±àÂëÓë "<META http-equiv=Content-Type content="text/html; charset=gb2312">" ÍøÒ³Ò³Ãæ
±àÂëÒ»ÖÂ,ÕâÑùÍøÒ³ÖоÍûÓÐÂÒÂëÁË¡£
$db->query("set client_encoding to 'gbk'");
Èç¹û²»Ïë¸ÄÅäÖÃÎļþ
ÔÚÒ³Ãæ´úÂëÖмÓÈëЧ¹ûÒ»Ñù!
ÔÀ´ÊÇÕâÑù£¬¿ÉÒÔÉèÖÿͻ§¶Ë±àÂëµÄ£¬ÎÒÒ»Ö±¸øÊý¾Ý¿â¶¨ÒåΪ
[code]
CREATE DATABASE hent
WITH OWNER = postgres
ENCODING = 'EUC_CN'
TABLESPACE = pg_default;
[/code]
¸ÄÈý¸öÅäÖÃÎļþ¼´¿É.Æäʵ´ó¼Ò¶¼ÖªµÀÊÇÄÄÈý¸öÁË.
php.ini my.cnf httpd.conf ¾ÍºÃÁË.°Ñ±àÂëÓйصͼÉèÖÃ³É utf-8¼´¿É.
µ«ÊÇ»¹²»ÐÐ.ÒòΪÎÒ°²×°ÁË. php-mbstring .ËùÒÔÔÚphp.iniÀïÃæÒ»¶¨Òª¿ªÆô mbstring ÇÒ±àÂëÒ²ÒªÉèÖóÉ
utf-8.
php.ini ;default_charset = "iso-8859-1" ¸Ä³É default_charset = "UTF-8"
<?
header('content-Type=text/html;charset=utf-8')
php
echo "t
Ïà¹ØÎĵµ£º
<?php
/*
ͼƬ´¦Àíº¯Êý¹¦ÄÜ£ºËõ·Å¡¢¼ôÇС¢Ïà¿ò¡¢Ë®Ó¡¡¢Èñ»¯¡¢Ðýת¡¢·×ª¡¢Í¸Ã÷¶È¡¢·´É«
´¦Àí²¢±£´æÀúÊ·¼Ç¼µÄ˼·£ºµ±ÓÐͼƬÓиĶ¯Ê±×Ô¶¯Éú³ÉÒ»ÕÅÐÂͼƬ£¬ÃüÃû·½Ê½¿ÉÒÔ¿¼ÂÇÔÚÔͼƬµÄ»ù´¡ÉϼÓÉϲ½Ö裬ÀýÈ磺ͼƬÃû³Æ+__µÚ¼¸²½
*/
class picture{
var $PICTURE_URL;//Òª´¦ÀíµÄͼƬ
var $DEST_URL="temp__01.jpg" ......
PHPÊÇÒ»ÃÅ¿ª·¢Ëٶȿ죬ÔËÐÐËÙ¶È¿ìµÄÓïÑÔ£¬µ«ÊÇËüÒ²ÓÐÖÂÃüȱµã£¬ÎÞ¶àỊ̈߳¨ËäÈ»ApacheµÄ·þÎñÆ÷ÔÚÁíÒ»Ö̶ֳÈÉÏÃÖ²¹ÁËÕâÖÖȱÏÝ£¬µ«ÊÇÔÚ±àдһЩÐèÒª¸ß²¢·¢²¢ÇÒ¿¼ÂÇЧÂʵijÌÐòÏ£¬Ëü»¹ÊÇÃ÷ÏÔ²»×㣩¡£
µ«ÊÇPHP¿ÉÒÔ´ó´óËõ¶Ì¿ª·¢ÖÜÆÚ£¬Ó뿪·¢³É±¾£¨±ÈÈçPHP¶ÔÓÚ³ÌÐòÒªÇóµÄÃż÷ºÜµÍ£©¡£
×ÜÌåÀ´Ëµ£¬PHPºÜÊʺϿª·¢ÍøÕ¾À´Ó㬶øÔÚ¿ª·¢ ......
²Î¿¼×ÊÁÏ£º
1.
2. http://www.phpeclipse.com/wiki/Howto/XDebugAndPHPEclipse
1.ÏÂÔØXDebug http://xdebug.org/download.php
Ñ¡ÔñÓÚPHP°æ±¾Ïà¶ÔÓ¦µÄµÄ 5.2 VC6 (32 bit) ÏÂÔØ£¬¸ÄÃû³Éphp_xdebug.dllºó¸´ÖƵ½E:/APMServ5.2.6/PHP/ext/ÖÐ
2£® ÔÚphp.iniÖÐÌí¼ÓÒÔÏÂÄÚÈÝ£¬²¢½«zendµÄÆäËûÓ¦Óùصô£¨×¢Ê͵ôÆäËûzend_extens ......
$ip = "1.1.1.255".chr(0)."haha";
if(ereg("^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$",$ip)) {
echo $ip;
} else {
echo "unknown";
}
Õâ¸öeregÕýÔòÏÞÖÆÁË$ipµÄÊý¾ÝΪxxx.xxx.xxx.xxxÕâÑùµÄÐÎʽ£¬±íÃæÉÏ¿´ÉÏÃæµÄ´úÂëÓ¦¸ÃÊä³ö"unknown"£¬¶øÊµ¼ÊÈ´Êä³öÁË"1.1.1.255haha"£¬ÒòΪeregº¯Êý´æÔÚNULL½Ø¶Ï ......