//最新の脚本ネット址を入手
関数 get_php_url(){
if(!empty($_SERVER["REQUEST_URI"])){
$scriptName = $_SERVER["REQUEST_URI"];
$nowurl = $scriptName;
}それ以外{
$scriptName = $_SERVER["PHP_SELF"];
if(empty($_SERVER["QUERY_STRING"])) $nowurl = $scriptName;
else $nowurl = $scriptName."?".$_SERVER["QUERY_STRING"];
}
$nowurl を返します。
}
//全角数字を半角数字に変える
関数 GetAlabNum($fnum){
$nums = array("0","1","2","3","4","5","6","7","8","9");
$fnums = "0123456789";
for($i=0;$i<=9;$i++) $fnum = str_replace($nums[$i],$fnums[$i],$fnum);
$fnum = ereg_replace("[^0-9.]|^0{1,}","",$fnum);
if($fnum=="") $fnum=0;
$fnum を返します。
}
//削除HTML标记
関数 Text2Html($txt){
$txt = str_replace(" "," ",$txt);
$txt = str_replace("<","<",$txt);
$txt = str_replace(">",">>",$txt);
$txt = preg_replace("/[rn]{1,}/isU","<br/>rn",$txt);
$txt を返します。
}
//清除HTML标记
関数 ClearHtml($str){
$str = str_replace('<','<',$str);
$str = str_replace('>','>',$str);
$str を返します。
}
// 相对路径转化成绝对路径
関数relative_to_absolute($content, $feed_url) {
preg_match('/(http|https|ftp):///', $feed_url, $protocol);
$server_url = preg_replace("/(http|https|ftp|news):///", "", $feed_url);
$server_url = preg_replace("//.*/", "", $server_url);
if ($server_url == '') {
$content を返します。
if (isset($protocol[0]))
{
$new_content = preg_replace('/href="//', 'href="'.$protocol[0].$server_url.'/', $content);
$new_content = preg_replace('/src="//', 'src="'.$protocol[0].$server_url.'/', $new_content);
} それ以外 {
$new_content = $content;
}
$new_content を返します。
}
// 全ての接続を取得
関数 get_all_url($code){
preg_match_all('/<as+href=["|']?([^>"' ]+)["|']?s*[^>]*>([^>]+ )</a>/i',$code,$arr);
return array('name'=>$arr[2],'url'=>$arr[1]);
}
//获取指定标记中の内容
function get_tag_data($str, $start, $end){
if ( $start == '' || $end == '' ){
戻る;
}
$str = 爆発($start, $str);
$str =explode($end, $str[1]);
$str[0] を返します;
}
//HTML表格の実行转はCSV格式数組
関数 get_tr_array($table) {
$table = preg_replace("'<td[^>]*?>'si",'"',$table);
$table = str_replace("</td>",'",',$table);
$table = str_replace("</tr>","{tr}",$table);
//去掉 HTML 标记
$table = preg_replace("'<[/!]*?[^<>]*?>'si","",$table);
//去掉空白文字
$table = preg_replace("'([rn])[s]+'","",$table);
$table = str_replace(" ","",$table);
$table = str_replace(" ","",$table);
$table =explode(",{tr}",$table);
array_pop($table);
$table を返します。
}
// HTML表格の実行列转を数組、表格データを収集
関数 get_td_array($table) {
$table = preg_replace("'<table[^>]*?>'si","",$table);
$table = preg_replace("'<tr[^>]*?>'si","",$table);
$table = preg_replace("'<td[^>]*?>'si","",$table);
$table = str_replace("</tr>","{tr}",$table);
$table = str_replace("</td>","{td}",$table);
//去掉 HTML 标记
$table = preg_replace("'<[/!]*?[^<>]*?>'si","",$table);
//去掉空白文字
$table = preg_replace("'([rn])[s]+'","",$table);
$table = str_replace(" ","",$table);
$table = str_replace(" ","",$table);
$table =explode('{tr}', $table);
array_pop($table);
foreach ($table as $key=>$tr) {
$td = 爆発('{td}', $tr);
配列ポップ($td);
$td_array[] = $td;
}
$td_array を返します。
}
//文字列内のすべての荕词を返します $distinct=true 去除重复
関数 split_en_str($str,$distinct=true) {
preg_match_all('/([a-zA-Z]+)/',$str,$match);
if ($distinct == true) {
$match[1] = array_unique($match[1]);
}
並べ替え($match[1]);
$match[1] を返します;
}