phpº¯Êý getenv()Óëputenv()ºÍ$_SERVER
[ת×Ô]http://hi.baidu.com/heiday/blog/item/ce3217006b10c0df277fb5b1.html
phpº¯Êý getenv()Óëputenv()ºÍ$_SERVER
2009-07-09 15:03
getenv È¡µÃϵͳµÄ»·¾³±äÁ¿
Óï·¨£ºstring getenv(string varname);-----------²ÎÊývarnameÓ¦¸ÃÊÇ$_SERVER£¨·þÎñÆ÷³¬¼¶È«¾Ö±äÁ¿Êý×飩ÖÐÔ¤¶¨µÄÔªËØË÷ÒýÃû¡¢»òÕßÊÇÓÃputenv("new=very new")¶¨ÒåÒ»ÏÂnewΪ»·¾³±äÁ¿£¬ËùÒÔnew×÷Ϊ²ÎÊý½«µÃÖµvery new
·µ»ØÖµ£º×Ö·û´®
º¯ÊýÖÖÀࣺPHP ϵͳ¹¦ÄÜ
ÄÚÈÝ˵Ã÷£ºÈôÕýÈ·È¡µÃ»·¾³±äÁ¿ varname£¬Ôò·µ»Ø±äÁ¿Öµ¡£Ê§°ÜÔò·µ»Ø false¡£
ʹÓ÷¶Àý
ÏÂÀý¿ÉÒÔÈ¡µÃÓû§ä¯ÀÀÆ÷ËùÔÚ»úÆ÷µÄÍøÖ·
<?
$ip = getenv(“REMOTE_ADDR”);
?>
$_SERVERÊÇ·þÎñÆ÷³¬¼¶È«¾Ö±äÁ¿Êý×é ÓÃ$_SERVER['REMOTE_ADDR']ͬÑù¿ÉÒÔ»ñÈ¡µ½¿Í»§¶ËµÄIPµØÖ·¡£
¶þÕßµÄÇø±ðÔÚÓÚ£¬getenv²»Ö§³ÖIISµÄisapi·½Ê½ÔËÐеÄphp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
putenv ÅäÖÃϵͳ»·¾³±äÁ¿
PHP putenv()Óï·¨£ºvoid putenv(string setting);
·µ»ØÖµ£ºÎÞ
º¯ÊýÖÖÀࣺPHP ϵͳ¹¦ÄÜ
ÄÚÈÝ˵Ã÷£º±¾º¯ÊýÓÃÀ´ÅäÖÃϵͳ»·¾³±äÁ¿¡£
ʹÓ÷¶Àý£º
ÅäÖà Oracle Êý¾Ý¿âÐèʹÓõĻ·¾³±äÁ¿ NLS_LANG£¬·µ»Ø×ÊÁϺ¬ÖÐÎÄ BIG5 Âë¡£
<?
putenv("NLS_LANG=american_taiwan.zht16big5");
?>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
putenv()Óëgetenv()×ÛºÏʾÀý
<?php
putenv("new=very new");
$is_new = getenv("new");
$new="bu shi";
echo $is_new,"<br />",$new;
?>
Êä³ö£º
very new
ËùÒÔ´ÓÉÏ¿ÉÒÔÖªµÀ²»ÓÃÅÂÔÚÎÒÃǵĴúÂëÀﶨÒåÓëputenv¶¨ÒåµÄ»·¾³±äÁ¿Í¬Ãû£¬Ïñ´ËÀýÖÐputenv("new=very new"); Óë $new="bu shi"; -----newÒ»ÑùÁËÒ²²»³ö´í¡£
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PHP·þÎñÆ÷±äÁ¿$_SERVERÏê½â£º
£¨ÒÔÏÂתÔØ×԰ٶȿռä“Õä°®ÉúÃü£¬Ô¶Àëó¦Ð·”£©ÔÎĵØÖ·£ºhttp://hi.baidu.com/sungoogle/blog/item/015d19305180869ba8018e68.html
Õä°®ÉúÃü£¬Ô¶Àëó¦Ð·
°®Éú»î£¬°®¹È¸è£»Ç¿ÁÒÇ´Ôð¶ÔgoogleµÄÎÞÀí·âɱ£¡
AD-->PHP/ASP¼¼ÊõÌÖÂÛȺ£¬ÈººÅ£º6092740
½ñÌì×ÐϸѧϰÁËÒ»ÏÂÊÖ²á¹ØÓÚ·þÎñÆ÷±äÁ¿µÄÄÚÈÝ£¬Ð´¸öÒ»¸ö±Ê¼Ç
Ïà¹ØÎĵµ£º
»ù±¾µÄ PHP Óï·¨
PHP µÄ½Å±¾¿éÒÔ <?php ¿ªÊ¼£¬ÒÔ ?> ½áÊø¡£Äú¿ÉÒÔ°Ñ PHP µÄ½Å±¾¿é·ÅÖÃÔÚÎĵµÖеÄÈκÎλÖá£
µ±È»£¬ÔÚÖ§³Ö¼òдµÄ·þÎñÆ÷ÉÏ£¬Äú¿ÉÒÔʹÓà <? ºÍ ?> À´¿ªÊ¼ºÍ½áÊø½Å±¾¿é¡£
²»¹ý£¬ÎªÁË´ïµ½×îºÃµÄ¼æÈÝÐÔ£¬ÎÒÃÇÍƼöÄúʹÓñê×¼ÐÎʽ (<?php)£¬¶ø²»ÊǼòдÐÎʽ¡£
<?php
?>
PHP Îļþͨ³£»á°ü ......
PHP µÄ $_GET ºÍ $_POST ÓÃÓÚ¼ìË÷±íµ¥ÖеÄÖµ£¬±ÈÈçÓû§ÊäÈë¡£
PHP ±íµ¥´¦Àí
±íµ¥ÊµÀý£º
<html>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
......
PhpArtile
¹Ù·½£ºhttp://www.21ds.net/
Õâ¸öËãÊǹúÄÚphpCmsµÄ×æ×ÚÁË£¬PAÓÉ PHP ÓïÑÔ¿ª·¢, ʹÓà MySQL Êý¾Ý¿â±£´æÊý¾Ý ,ΪÖÐСÐÍÍøÕ¾·¢±íÎÄÕÂ, ´æ·Å×ÊÁÏ, ÐÂÎÅ·¢²¼Ìṩһ¸öÍêÃÀµÄ½â¾ö·½°¸¡£
×öÁ˺ü¸ÄêÁË£¬3.0³Ù³Ù»¹ÔÚ¿ª·¢ÖУ¬½ñÄê³öÁË2.1»ðÁËÒ»Õó£¬ÓÖϨÃðÁË£¬ÒÔÇ°ÓõÄÈËͦ¶àµÄ£¬ÏÖÔÚ»ù±¾ÉÏûÂäÁË¡£
......
¹«Ë¾·´Ó¦Äͷɼҽ̺ͼæÖ°ºǫ́ÏÔʾµÄʱ¼ä¸úʵ¼Ê×¢²áµÄʱ¼äÏà²î8Сʱ¡£
·¢ÏÖʱ¼äÒ»Ö±¶Ô²»ÉÏ£¬date("Y-m-d h:i:s") ×ÜÊÇÓë·þÎñÆ÷ʱ¼ä²î8¸öСʱ£®ºóÀ´·¢ÏÖ£¬ÎÒÏÖÔڵĻúÆ÷ÉϵÄphpÊÇ5.14µÄ£®¡¡
ÔÀ´´Óphp5.1.0¿ªÊ¼£¬php.iniÀï¼ÓÈëÁËdate.timezoneÕâ¸öÑ¡ÏĬÈÏÇé¿öÏÂÊǹرյÄ
Ò²¾ÍÊÇÏÔʾµÄʱ¼ä£¨ÎÞÂÛÓÃʲôphpÃüÁ¶¼ÊǸñÁ ......
Èç¹ûÄúʹÓùý PHP£¬Äú¾Í»á·¢ÏÖËüÊÇ´´½¨ÌØÐԷḻµÄ Web Ò³ÃæµÄ³öÉ«¹¤¾ß¡£×÷Ϊһ´ó½Å±¾ÓïÑÔ£¬PHP£º
ÈÝÒ×ѧϰ¡£
ÓÐÐí¶àÇ¿´óµÄ¿ò¼Ü£¨±ÈÈç CakePHP ºÍ CodeIgniter£©£¬ÈÃÄúÄܹ»Ïñ Rails ³ÌÐòÔ±Ò»Ñù¸ßЧ¡£
Äܹ»Óë MySQL¡¢PostgreSQL¡¢Microsoft® SQL Server£¬ÉõÖÁ Oracle ͨÐÅ¡£
Äܹ»ÇáËɵØÓë JavaScript ¿ò¼Ü¼¯³É£¬±È ......