PHPµÄÈýµã¾«»ª½éÉÜ
ÎÒ·¢ÏֺܶàµÄPHP³ÌÐòÔ±£¬ÓÈÆäÊÇѧϰ»¹²»ÊǺܾõģ¬¶¼²»ÖªµÀPHPµÄ¾«»ªËùÔÚ¡£Perlµ±ÄêÈçºÎÔÚÉ̽ç³öÃû£¿ÆäÇ¿´óµÄÕýÔò±í´ïʽ¡£¶øPHPÄØ£¿ËûÊÇÒ»ÃÅ´ÓUnixÏ·¢Õ¹ÆðÀ´µÄÓïÑÔ£¬µ±È»Ò²¾Í¼Ì³ÐÁËPerlµÄºÜ¶àÌص㣬ͬʱCµÄÓŵ㶼ÓС£¿ìËÙ¡¢¼ò½à¡¢Ã÷ÁË£¬ÓÈÆäÊÇC³ÌÐòÔ±£¬PHPÊÇÖÁ°®£¬ÎÒ¾ÍÊÇÉî°®×Å“PHP”£¨¶¼ÍüÁËÅ®ÓÑÁË:)£©¡£ÕâÀÎÒÏëÀ´Ð´Ò»ÆªPHPµÄ±äÁ¿¡¢Êý×éÓ¦Óü¼ÇɺÍPHPµÄÕýÔò±í´ïʽ¡¢PHPµÄÄ£°åÓ¦Óã¬ÒÔºóÓÐʱ¼äÔÙдPHPÓëCOM¡¢PHPÓëXMLµÄÍêÈ«½áºÏ¡£
1¡¢±äÁ¿¡¢Êý×éµÄÓ¦Óü¼ÇÉ
(1)ºÜ¶àÈËÓõò»¶àµÄÊý×麯Êý¡£foreach¡¢list¡¢each¡£·Ö±ð¾Ù¼¸¸öÀý×Ó£¬Ó¦¸Ã¾ÍÄÜÖªµÀÁË¡£Àý£º
<?php
$data = array('a' => 'data1', 'b' => 'data2', 'c' => 'data3');
while(list($subscript, $value) = each($data))
{
echo "$subscript => $value :: ";
echo "$subscript => $value <br>";
}
reset($data);
foreach($data as $subscript => $value)
{
echo "$subscript => $value :: ";
echo "$subscript => $value <br>";
}
(2)º¯ÊýµÄ±äÁ¿¡¢±äÁ¿µÄ±äÁ¿¡¢±äÁ¿µÄ“Ö¸Õ딣º¿´ÏÂÀý£º
<?php
//±äÁ¿µÄ±äÁ¿
$var = "this is a var";
$varname = "var";
echo $$varname;
//º¯ÊýµÄ±äÁ¿
function fun1($str) {
echo $str;
}
$funname = "fun1";
$funname("This is a function !");
?>
±äÁ¿µÄ“Ö¸Õ딡£Õâ¸öÖ¸Õë¼ÓÉÏÁËË«ÒýºÅ£¬±íÃ÷Ëû²»ÊÇÕæÕýµÄÖ¸Õë¡£¿´¿´ÏÂÀý£º
<?php
function($a) {
$a ++;
}
$c = 0;
function($c);
echo $c; //$cÈÔΪ0
function(&$a) {
$a ++;
}
$c = 0;
echo $c; //$cΪ1
?>
Ö®ËùÒÔ³ÆÆäΪ“Ö¸Õ딣¬¾ÍÊÇÒòΪËûÓÐÁ˺ÍCÓïÑÔÖÐÖ¸ÕëÏàͬµÄ¹¦ÄÜ¡£µ«ÕâÓÖ²»ÊÇÕæÕýµÄÖ¸Õ룬ֻÄܹ»ÊÇÕâÑùµÄÈ¥Àí½â¡£
2¡¢ÕýÔò±í´ïʽ
ÕýÔò±í´ïʽÊÇÒ»¸ö·Ç³£´óµÄÌâÄ¿£¬PerlµÄÕýÔò±í´ïʽµÄÇ¿´ó
Ïà¹ØÎĵµ£º
1.globalÔÚÕû¸öÒ³ÃæÆð×÷Óá£
2.staticÖ»ÔÚfunctionºÍclassÄÚÆð×÷Óá£
globalºÍ$GLOBALSʹÓûù±¾Ïàͬ£¬µ«ÔÚʵ¼Ê¿ª·¢Öдó²»Ïàͬ¡£
globalÔÚº¯Êý²úÉúÒ»¸öÖ¸Ïòº¯ÊýÍⲿ±äÁ¿µÄ±ðÃû±äÁ¿£¬¶ø²»ÊÇÕæÕýµÄº¯ÊýÍⲿ±äÁ¿£¬Ò»µ«¸Ä±äÁ˱ðÃû±äÁ¿µÄÖ¸ÏòµØÖ·£¬¾Í»á·¢ÉúһЩÒâÁϲ»µ½Çé¿ö£¬ÀýÈçÀý×Ó1.
$GLOBALS[]ȷȷʵʵµ÷ÓÃÊÇÍⲿµÄ±äÁ¿£ ......
1¡¢PHP·¢ËÍÖÐÎÄ¡¢Ajax½ÓÊÕ
Ö»ÐèÔÚphp¶¥²¿¼ÓÈëÒ»¾ä£º
header('Content-type: text/html;charset=GB2312');
xmlHttp»áÕýÈ·½âÎöÆäÖеÄÖÐÎÄ¡£
2¡¢Ajax·¢ËÍÖÐÎÄ¡¢PHP½ÓÊÕ
Õâ¸ö±È½Ï¸´ÔÓ£º
AjaxÖÐÏÈÓÃencodeURIComponent¶ÔÒªÌá½»µÄÖÐÎĽøÐбàÂë
PHPÖУº
$GB2312string=iconv( ‘UTF-8′, ‘gb2312//I ......
ÎÞÒâ¼ä¿´µ½ÒÔÇ°·¢µÄÌû×Ó.»ØÒäÆðÄÇЩPHPµÄÈÕÈÕÒ¹Ò¹
http://www.phpfans.net/ask/discuss2/343326196.html
<?
class gzg//¸ÆÖиÆÀà
{
var $x;//ÊôÐÔ
function gzg()//¹¹Ô캯Êý,ĬÈϲ»³Ô¸ÆÖиÆ
&n ......
//´´½¨Îļþ¼ÐµÄ·½·¨
//$path ΪÎļþ¼Ð²ÎÊý£¬Èç £¨c:/program files/makedir£©
function createFolders($path) {
if (!file_exists($path)) {
$this->createFolders(dirname($path));
mkdir($path, 0777);
&n ......
PHP Security for Deployers
If you're a Developer
READ THIS and then work with your SysAdmins to step through any and all the layers of security designed to protect your apps.
Example:
Traffic must first pass through a SPI firewall (ensure that ONLY necessary ports/protocols are permitted; en ......