¡¾×ª¡¿ phpÖÐrequire×¢ÒâÊÂÏî
¡¾×ª×Ô¡¿£ºhttp://blog.miaoheguang.tk/archives/11
±»PHPµÄinclude·¾¶ÅªÔÎÁË¡£×Ô¼ºÊÔÑéһͨ£¬×ܽáÈçÏ¡£
¶¨ÒåA=°üº¬Îļþ B=±»A°üº¬µÄÎļþ C=±»B°üº¬µÄÎļþ
Ò²¾ÍÊÇ˵ A °üº¬ B£¬ B°üº¬C
AÖÐÓÐ
Php ´úÂë
require ‘[B·¾¶]‘ //(ÕâÀï µÄrequire¿ÉÒÔ»»³Érequire_once include)
require ‘[B·¾¶]‘ //(ÕâÀïµÄrequire¿ÉÒÔ»»³Érequire_once include)
B ÖÐÓÐ
Php´úÂë
require ‘[C·¾¶]‘ //(ÕâÀï µÄrequire¿ÉÒÔ»»³Érequire_once include)
require ‘[C·¾¶]‘ //(ÕâÀïµÄrequire¿ÉÒÔ»»³Érequire_once include)
ÏÂÃæµÄÌÖÂÛÖ÷ÒªÕë¶ÔAΪÈë¿ÚÎļþ£¬¼´Ö»Ö±½Ó·ÃÎÊA£¬²»Ö±½Ó·ÃÎÊB¡£
Ê×Ïȶ¨ÒåÁ½¸ö¸ÅÄÏà¶Ô·¾¶ºÍȫ·¾¶£¬ÎÒ¶ÔËüÃǵĶ¨ÒåÊÇ£¬Ïà¶Ô·¾¶Ö¸ÒÔ. ¿ªÍ·µÄ·¾¶£¬ÀýÈç ./a/a.php (Ïà¶Ôµ±Ç°Ä¿Â¼)
../common.inc.php (Ïà¶ÔÉϼ¶Ä¿Â¼)£¬
ȫ·¾¶ÊÇÒÔ/¿ªÍ·»òÕßwindowsϵÄC:/ÀàËƵÄÅÌ·û¿ªÍ·µÄ·¾¶£¬È«Â·¾¶²»ÓÃÈκβο¼Â·¾¶¾Í¿ÉÒÔΨһȷ¶¨ÎļþµÄ×îÖÕµØÖ·¡£ ÀýÈç
/apache/wwwroot/site/a/a.php c:/wwwroot/site/a/a.php
³ýÁËÏà¶Ô·¾¶ºÍȫ·¾¶Ö®ÍâµÄ·¾¶»¹ÓÐÆäËûÀàÐ͵Ä·¾¶Â𣿠»¹ÓС£·²ÊDz»ÒÔ.»òÕß/¿ªÍ·¡¢Ò²²»ÊÇwindowsÏÂÅÌ·û:/¿ªÍ·µÄ·¾¶£¬ÀýÈç
a/a.php common.inc.php£¬ÕâÑùµÄ·¾¶£¬¾ÍÊǵÚÈýÖÖ
ÀàÐÍ·¾¶¡£¿ªÊ¼ÒÔΪÕâÒ²ÊÇÏà¶Ô·¾¶£¬µ«ÔÚphpµÄinclude/require°üº¬»úÖÆ ÖУ¬ÕâÖÖÀàÐ͵Ä·¾¶¸úÒÔ.¿ªÍ·µÄÏà¶Ô·¾¶´¦ÀíÊÇÍêÈ«²»Í¬µÄ¡£
£¨require ‘./a.php’ ºÍ require ‘a.php’ ÊDz»Í¬µÄ£¡£©ÎÒÃǹÃÇÒ½ÐÕâÖÖ·¾¶ÎªÎ´È·¶¨Â·¾¶
ÏÂÃæ·ÖÎöÕâÈýÖÖÀàÐÍ°üº¬Â·¾¶µÄ´¦Àí·½Ê½£ºÊ×ÏȼÇסһ¸ö½áÂÛ£ºÈç¹û°üº¬Â·¾¶ÎªÏà¶Ô·¾¶»òÕßȫ·¾¶£¬Ôò²»»áµ½include_pathÖÐÈ¥²éÕÒ¸ÃÎÄ
¼þ£¬Ò²¾ÍÊÇ˵²»¹Üphp.iniÖж¨ÒåµÄinclude_path»·¾³±äÁ¿ÊǶàÉÙ£¬»òÕßÔÚ³ÌÐòÖÐÉèÖÃset_include_path(…)Ϊ¶àÉÙ¡£
ÒýÓÃ
If a path is defined (full or relative), the include_path will be
ignored altogether.
×¢Ò⣺ÏÂÃæµÄÌÖÂۺͽáÂÛ»ùÓÚÕâÑùµÄ»·¾³£º
¼ÙÉè A=[SITE]/app/test/main.php£¬ ÔÙ´ÎÇ¿µ÷ÏÂÃæµÄÌÖÂÛÊÇÕë¶ÔÖ±½Ó·ÃÎÊAµÄÇé¿ö¡£
([SITE]´ú±íÕ¾µãµÄ¸ùĿ¼£¬¿ÉÒÔÌæ»»³É³Éhttp://www.xxx.comÕâÑùµÄÓòÃû¸ù·¾¶»òÕßÎĵµ´æ´¢µÄÎïÀíĿ¼È磺
c:/wwwroot/xxx.com »òÕß /usr/wwwroot/xxx.com )£¬Çë¶ÁÕßÔÚ×Ô¼ºÄܲâÊÔµÄÍøÕ¾¸ùĿ¼´´½¨/app/test/
Ŀ¼£¬²¢ÔÚÆäÖд´½¨main.php£¬×îºÃÊÇ°ÑÏÂÃæµ
Ïà¹ØÎĵµ£º
Ò»¡¢¸½¼ÓÂëµÄ×÷ÓÃ
¡¡¡¡±¾ÎÄËùÊöµÄ¸½¼ÓÂë½öÖ¸ÔÚWEBÉÏʹÓõĶàÓÃÓÚÉí·ÝÑéÖ¤µÄ¸½¼ÓÂë¡£
¡¡¡¡¸½¼ÓÂëµÄÖ÷Òª×÷ÓÿÉÄÜÊÇ·ÀÖ¹±©Á¦·ÃÎÊ£¬ÀýÈ籩Á¦·½Ê½µÄÃÜÂëÆƽâºÍÐÅÏ¢·¢²¼¡£
¡¡¡¡¸½¼ÓÂëÔÚÓû§Éí·ÝÑéÖ¤·½ÃæµÄÓ¦ÓÃÄܹ»´ÓÒ»¶¨³Ì¶ÈÉÏ·ÀÖ¹¶ÔÓû ......
$file1 = 'F:/46.gif';
$file2 = 'F:/test.txt';
$file3 = 'F:/47.gif';
$size = filesize($file1);
echo 'Îļþ´óСΪ£º'.$size;
echo "\n<br>ת»¯Îª¶þ½øÖÆ ...";
$content = file_get_contents($file1);
$content = bstr2bin($content);
$fp = fopen($file2, 'w');
fwrite($fp, $content);
fclose($fp);
......
www.diybl.com¡¡Ê±¼ä£º2008-06-01¡¡×÷Õß:ØýÃû
½«Æä±£´æ³ÉÒ»¸öÎļþ£¬ÓÃʱµ÷ÓÃ
<?
//ΪÁ˱ÜÃâÖظ´°üº¬Îļþ¶øÔì³É´íÎ󣬼ÓÁËÅжϺ¯ÊýÊÇ·ñ´æÔÚµÄÌõ¼þ£º
if(!function_exists(pageft)){
//¶¨Ò庯Êýpageft(),Èý¸ö²ÎÊýµÄº¬ÒåΪ£º
//$totle£ºÐÅÏ¢×ÜÊý£»
//$displaypg£ºÃ¿Ò³ÏÔʾÐÅÏ¢Êý£¬ÕâÀïÉèÖÃΪĬÈÏÊÇ20£»
//$url£º·Ö ......
PHP´ÓPHP5¿ªÊ¼£¬³¹µ×ÖØбàдµÄºÍÐÂÔöÁ˶ÔXMLµÄÀ©Õ¹£¬Èç SAX ½âÎöÆ÷¡¢DOM¡¢SimpleXML¡¢XMLReader¡¢XMLWriter ºÍ XSLT ´¦Àí³ÌÐò¡£ËùÓÐÕâЩÀ©Õ¹¶¼ÒÔ libxml2 Ϊ»ù´¡¡£
=============================
1¡¢DOMDocument¶ÔÏó³£Ó÷½·¨£º
=============================
a£©createElement(elementName)
¸Ã· ......
<?php
/*
* Ãû³Æ : MySQLÊý¾Ý¿â»ù±¾²Ù×÷
* ×÷Õß : pjx
* °æ±¾ : v 2010/02/25 v 1.0
* ˵Ã÷ : ¸ÃÀàÓÃÓÚ¶ÔMySQL×öһЩ¼òµ¥µÄ²Ù×÷
* ʾÀý £º
* ʵÀý => $db = new DB_MYSQL($database),´ò¸ö$databaseÊý¾Ý¿â
* ²éѯÊý¾Ý¿â => $db->query($sql_str),²éѯ$sql_st ......