Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

PHP autoload»úÖÆÏê½â

(1) autoload»úÖƸÅÊö
ÔÚʹÓÃPHPµÄOOģʽ¿ª·¢ÏµÍ³Ê±£¬Í¨³£´ó¼ÒÏ°¹ßÉϽ«Ã¿¸öÀàµÄʵÏÖ¶¼´æ·ÅÔÚÒ»¸öµ¥¶ÀµÄÎļþÀÕâÑù»áºÜÈÝÒ×ʵÏÖ¶ÔÀà½øÐи´Óã¬Í¬Ê±½«À´Î¬»¤Ê±Ò²ºÜ±ãÀû¡£ÕâÒ²ÊÇOOÉè¼ÆµÄ»ù±¾Ë¼ÏëÖ®Ò»¡£ÔÚPHP5֮ǰ£¬Èç¹ûÐèҪʹÓÃÒ»¸öÀֻ࣬ÐèÒªÖ±½ÓʹÓÃinclude/require½«Æä°üº¬½øÀ´¼´¿É¡£ÏÂÃæÊÇÒ»¸öʵ¼ÊµÄÀý×Ó£º
CODE:
/* Person.class.php */
<?php
class Person {
  var $name, $age;
  
  function __construct ($name, $age)
  {
   $this->name = $name;
   $this->age = $age;
  }
}
?>
CODE:
/* no_autoload.php */
<?php
require_once ("Person.class.php");
$person = new Person("Altair", 6);
var_dump ($person);
?>ÔÚÕâ¸öÀý×ÓÖУ¬no-autoload.phpÎļþÐèҪʹÓÃPersonÀ࣬ËüʹÓÃÁËrequire_once½«Æä°üº¬£¬È»ºó¾Í¿ÉÒÔÖ±½ÓʹÓÃPersonÀàÀ´ÊµÀý»¯Ò»¸ö¶ÔÏó¡£
µ«Ëæ×ÅÏîÄ¿¹æÄ£µÄ²»¶ÏÀ©´ó£¬Ê¹ÓÃÕâÖÖ·½Ê½»á´øÀ´Ò»Ð©Òþº¬µÄÎÊÌ⣺Èç¹ûÒ»¸öPHPÎļþÐèҪʹÓúܶàÆäËüÀ࣬ÄÇô¾ÍÐèÒªºÜ¶àµÄrequire/include Óï¾ä£¬ÕâÑùÓпÉÄÜ»áÔì³ÉÒÅ©»òÕß°üº¬½ø²»±ØÒªµÄÀàÎļþ¡£Èç¹û´óÁ¿µÄÎļþ¶¼ÐèҪʹÓÃÆäËüµÄÀ࣬ÄÇôҪ±£Ö¤Ã¿¸öÎļþ¶¼°üº¬ÕýÈ·µÄÀàÎļþ¿Ï¶¨ÊÇÒ»¸öجÃΡ£
PHP5ΪÕâ¸öÎÊÌâÌṩÁËÒ»¸ö½â¾ö·½°¸£¬Õâ¾ÍÊÇÀàµÄ×Ô¶¯×°ÔØ(autoload)»úÖÆ¡£autoload»úÖÆ¿ÉÒÔʹµÃPHP³ÌÐòÓпÉÄÜÔÚʹÓÃÀàʱ²Å×Ô¶¯°üº¬ÀàÎļþ£¬¶ø²»ÊÇÒ»¿ªÊ¼¾Í½«ËùÓеÄÀàÎļþinclude½øÀ´£¬ÕâÖÖ»úÖÆÒ²³ÆΪlazy loading¡£
ÏÂÃæÊÇʹÓÃautoload»úÖƼÓÔØPersonÀàµÄÀý×Ó£º
CODE:
/* autoload.php */
<?php
function __autoload($classname) {
  require_once ($classname . "class.php");
}
$person = new Person("Altair", 6);
var_dump ($person);
?>ͨ³£PHP5ÔÚʹÓÃÒ»¸öÀàʱ£¬Èç¹û·¢ÏÖÕâ¸öÀàûÓмÓÔØ£¬¾Í»á×Ô¶¯ÔËÐÐ__autoload()º¯Êý£¬ÔÚÕâ¸öº¯ÊýÖÐÎÒÃÇ¿ÉÒÔ¼ÓÔØÐèҪʹÓõÄÀà¡£ÔÚÎÒÃÇÕâ¸ö¼òµ¥µÄÀý×ÓÖУ¬ÎÒÃÇÖ±½Ó½«ÀàÃû¼ÓÉÏÀ©Õ¹Ãû".class.php"¹¹³ÉÁËÀàÎļþÃû£¬È»ºóʹÓÃrequire_once½«Æä¼ÓÔØ¡£´ÓÕâ¸öÀý×ÓÖУ¬ÎÒÃÇ¿ÉÒÔ¿´³öautoloadÖÁÉÙÒª×öÈý¼þÊÂÇ飬µÚÒ»¼þÊÂÊǸù¾ÝÀàÃûÈ·¶¨ÀàÎļþÃû£¬µÚ¶þ¼þÊÂÊÇÈ·¶¨ÀàÎļþËùÔڵĴÅÅÌ·¾¶(ÔÚÎÒÃǵÄÀý×ÓÊÇ×î¼òµ¥µÄÇé¿ö£¬ÀàÓëµ÷ÓÃËüÃǵÄPHP³ÌÐòÎļþÔÚͬһ¸öÎļþ¼ÐÏÂ)£¬µÚÈý¼þÊÂÊǽ«Àà´Ó´ÅÅÌÎļþÖмÓÔص½ÏµÍ³ÖС£µÚÈý²½×î¼òµ¥£¬Ö»ÐèҪʹÓà in


Ïà¹ØÎĵµ£º

[php]how to confirm deleting without using form.

<html>
<head>
<script type="text/javascript">
<!--
function confirmDelete()
{
    return confirm("Are you sure you wish to delete this entry?");
}   
//-->
</script>
</head>
<body>
<% $var1 = 2;%> ......

phpÔÚ2003SERVERϵÄÅäÖÃ

Ò»¡¢ÏµÍ³»·¾³¼°³ÌÐò˵Ã÷
1¡¢²Ù×÷ϵͳΪwindows server 2003
2 ¡¢iis°æ±¾Îª6.0
3¡¢php°æ±¾Îª5.2.9,¹Ù·½ÏÂÔصØÖ·: http://www.php.net/downloads.php
4¡¢mysql°æ±¾Îª5.1.34,¹Ù·½ÏÂÔصØÖ·:http://dev.mysql.com/downloads/mysql
¶þ¡¢°²×°iis
1¡¢²åÈëwindows server 2003ϵͳ°²×°¹âÅÌ
2¡¢¿ªÊ¼-¿ØÖÆÃæ°å-Ìí¼Óɾ³ý³ÌÐ ......

¹ØÓÚPHPºÍphpMyAdminµÄÄÇЩÊÂ


°²×°
$cfg['PmaAbsoluteUri'] = 'http://localhost/phpMyAdmin/';//phpMyAdminµÄ°²×°Â·¾¶
$cfg['blowfish_secret'] = '123456';//¼ÓÃÜÃܳף¬¿ÉËæÒâ¸ü¸Ä¡£
$cfg['Servers'][$i]['user'] = 'root'; // MySQLÓû§£¬Èç root
$cfg['Servers'][$i]['password'] = 'pswd'; // MySQLÓû§ÃÜÂë
$cfg['DefaultLang'] = '';¡¡¸ÄÎ ......

php ³ÌÐòµÄ¹ú¼Ê»¯gettext

²½ÖèÒ»£º´î½¨»·¾³
1£¬Ê×ÏȲ鿴ÄãµÄphpÀ©Õ¹Ä¿Â¼ÏÂÊÇ·ñÓÐphp_gettext.dllÕâ¸ö
Îļþ£¬Èç¹ûûÓУ¬Õâ¾ÍÐèÒªÄã
ÏÂÔØÒ»¸ö»òÊÇ´ÓÆäËûµØ·½¿½±´Ò»¸ö£¬È»ºó·Åµ½phpÀ©Õ¹Ä¿Â¼¡£
2£¬´ò¿ªphp.ini£¬²é
ÕÒ”;extension=php_gettext.dll“ £¬È»ºóÈ¥³ý×¢ÊÍ£¬ÖØÆôapache¡£
²½Öè¶þ:Ô­Àí½²½â
¼ÙÈçÄãµÄû
Óйú¼Ê»¯µÄ³ÌÐòÀïÓÐÕâÑù ......

ÈçºÎÔÚPHPÖд´½¨Êý×é

Ô­ÎÄÁ´½Ó£ºhttp://www.phpdo.net/index.php/20100409/54.html
ÈçºÎÔÚPHPÖд´½¨Êý×éÄØ£¿
ÔÚPHPÖÐʹÓÃarrayº¯ÊýÀ´´´½¨Ò»¸öÊý×飬ËüÔÊÐíÒ»¶¨ÊýÁ¿ÓöººÅkey=>value²ÎÊý¡£Key¿ÉÒÔÊÇinteger»òÕßstringÀàÐÍ£¬value¿ÉÒÔÊÇÈκÎÖµ¡£
ÀýÈ磺
 <?php
 $array = array(“php1″=>”phpdo”, ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ