function write ( $data ) { $return = false; if ( $handle = @fopen ( 'error.txt','a+' ) ) {…
php中可以通过设置header的content-type,强制用户下载内容,而非直接在浏览器中打开,如下代码实现: downloadFile.php <?php $file…
//获取某个月的最后一天或某个月的天数 function getMonthLastDay ( $month, $year ) { switch ( $month ) { case …
$arr=str_split($str); $arr=array_count_values($arr); arsort($arr); print_r($arr);
function userOS(){ $user_OSagent = $_SERVER['HTTP_USER_AGENT']; if(strpos($user_OSagent,&q…
/** * * 中文字符串截取 * @param string $string * @param int $sublen * @param int $start * @param …
//https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)? //PHP Example: Automatically link UR…
/** * 图片缩放水印类 * */ class cls_photo { protected $waterrate = 0.2; //水印图标在图片上的比例 protected $…
function smart_resize_image( $file, $width = 0, $height = 0, $proportional = false, $outpu…
/** * 过滤字符串中的html标签 * * @param string $string 待转换的字符串 * @return string */ static public fu…
/** * 多个连续空格只保留一个 * * @param string $string 待转换的字符串 * @return unknown */ static public fun…
//PHP(前提是装了curl): $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, "http://www.xxx/&…