随笔分类 -  PHP

PHP中const的使用
摘要: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 阅读(17491) 评论(0) 推荐(0) 编辑
PHP计算两个路径的相对路径
摘要: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 阅读(2729) 评论(0) 推荐(0) 编辑