摘要:        
1 <html> 2 <body> 3 <?php 4 function traverse($path = '.') { 5 $current_dir = opendir($path); //opendir()返回一个目录句柄,失败返回false 6 while(($file = readdir($current_dir)) !== false) { //readdir()返回打开目录句柄中的一个条目 7 $sub_dir = $...    阅读全文
        posted @ 2012-05-04 14:03
ZimZz
阅读(23701)
评论(0)
推荐(2)
            
        
        
摘要:        
1 <html> 2 <body> 3 <?php 4 $paths[] = $_SERVER['REQUEST_URI']; //$_SERVER['REQUEST_URI']获取当前请求URI,不包括域名 5 $paths[] = $_SERVER['SCRIPT_NAME']; //$_SERVER['SCRIPT_NAME']获取当前执行脚本的名称,该路径从document_root开始 6 $paths[] = $_SERVER['SCRIPT_FILENAME']; ...    阅读全文
        posted @ 2012-05-04 03:47
ZimZz
阅读(2042)
评论(0)
推荐(1)
            
        
        
摘要:        
1 <html> 2 <body> 3 <!-- define不可用于类内部 --> 4 <?php 5 define('COUNTRY', 'China'); 6 echo COUNTRY . '<br>'; 7 ?> 8 9 <!-- define的条件使用和变量赋值 -->10 <?php11 $i = 1;12 if($i > 0) { //define可以用于条件语句,cons...    阅读全文
        posted @ 2012-05-04 01:58
ZimZz
阅读(2854)
评论(0)
推荐(0)
            
        
        
摘要:        
1 <html> 2 <body> 3 <!-- 在类中的使用 --> 4 <?php 5 class TestStatic { 6 public static $country = 'China'; //在类内static可以使用public修饰 7 8 public function getCountry() { 9 return self::$country; ...    阅读全文
        posted @ 2012-05-04 01:49
ZimZz
阅读(299)
评论(0)
推荐(0)
            
        
        
摘要:        
1 <html> 2 <body> 3 <!-- 类内声明及使用 --> 4 <?php 5 class TestConst { 6 const COUNTRY = 'China'; //const不能加public,static,也不需要$ 7 static $static = 'Static'; 8 9 public function getCountry() {10...    阅读全文
        posted @ 2012-05-04 01:30
ZimZz
阅读(17501)
评论(0)
推荐(0)
            
        
        
摘要:        
1 <html> 2 <body> 3 <?php 4 function relativePath($aPath, $bPath) { 5 $aArr = explode('/', $aPath); //explode函数用于切分字符串,返回切分后的数组,此处用'/'切分字符串 6 $bArr = explode('/', $bPath); 7 $aDiffToB = array_diff_assoc($aArr, $bArr); //a...    阅读全文
        posted @ 2012-05-04 01:19
ZimZz
阅读(2743)
评论(0)
推荐(0)
                    
                
浙公网安备 33010602011771号