This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function quickSort(array $array) | |
{ | |
$len = count($array); | |
if($len <= 1) | |
{ | |
return $array; | |
} | |
$key = $array[0]; | |
$left = array(); | |
$right = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function bubbingSort(array $array) | |
{ | |
for($i=0, $len=count($array)-1; $i<$len; ++$i) | |
{ | |
for($j=$len; $j>$i; --$j) | |
{ | |
if($array[$j] < $array[$j-1]) | |
{ | |
$temp = $array[$j]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* PHP万年历 | |
* @author Fly 2012/10/16 | |
*/ | |
class Calendar{ | |
protected $_table;//table表格 | |
protected $_currentDate;//当前日期 | |
protected $_year; //年 | |
protected $_month; //月 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
class ftp { | |
var $ftpUrl = ''; | |
var $ftpUser = ''; | |
var $ftpPass = ''; | |
var $ftpDir = ''; | |
var $ftpR = ''; //R ftp资源; | |
var $status = ''; | |
//R 1:成功;2:无法连接ftp;3:用户错误; | |
function ftp($ftpUrl="", $ftpUser="", $ftpPass="", $ftpDir="") { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @author 零起点工作室 | |
* @version v1.0 | |
* @copyright 2010 | |
* | |
* @todo 工具类,常用函数 | |
* | |
*/ | |
class CUtil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function curPageURL() | |
{ | |
$pageURL = 'http'; | |
if ($_SERVER["HTTPS"] == "on") | |
{ | |
$pageURL .= "s"; | |
} | |
$pageURL .= "://"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//加载 顶级大类,子类,三级 | |
$cateArr = $subArr = $grandArr = $secCur = array(); | |
$classArr = F::S('Dal_Cate')->get(array('status'=> -1)); | |
if ($classArr) foreach ($classArr as $_k => $_v) { | |
if ($_v['subid'] && $_v['cateid']) { | |
$grandArr[$_v['cateid']][$_v['subid']][$_v['id']] = $_v; | |
} else if ($_v['cateid']) { | |
$subArr[$_v['cateid']][$_v['id']] = $_v; | |
}else if(!$_v['subid'] && !$_v['cateid']) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//获取所有内容url保存到文件 | |
function get_index($save_file, $prefix="index_"){ | |
$count = 68; | |
$i = 1; | |
if (file_exists($save_file)) @unlink($save_file); | |
$fp = fopen($save_file, "a+") or die("Open ". $save_file ." failed"); | |
while($i<$count){ | |
$url = $prefix . $i .".htm"; | |
echo "Get ". $url ."..."; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**************************************************************/ | |
/** | |
* 调用系统命令解压缩zip上传图片 add by zgm 2012-3-20 13:50:42 | |
* | |
* @param string $filename 原始文件 | |
* @param string $unzip_dir 解压目录 | |
* @return array 解壓文件名數組 | |
*/ | |
public static function unZip($filename,$unzip_dir) { | |
$str = "unzip -Loj $filename -d $unzip_dir"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************************************************************** | |
* | |
* 使用特定function对数组中所有元素做处理 | |
* @param string &$array 要处理的字符串 | |
* @param string $function 要执行的函数 | |
* @return boolean $apply_to_keys_also 是否也应用到key上 | |
* @access public | |
* | |
*************************************************************/ |