//获得当前的脚本网址
fungsi get_php_url(){
if(!empty($_SERVER["REQUEST_URI"])){
$scriptName = $_SERVER["REQUEST_URI"];
$nowurl = $namaskrip;
}kalau tidak{
$scriptName = $_SERVER["PHP_SELF"];
if(kosong($_SERVER["QUERY_STRING"])) $nowurl = $scriptName;
lain $nowurl = $scriptName."?".$_SERVER["QUERY_STRING"];
}
kembalikan $sekarang;
}
//把全角数字转为半角数字
fungsi GetAlabNum($fnum){
$angka = 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);
jika($fnum=="") $fnum=0;
kembalikan $fnum;
}
//去除HTML标记
fungsi Text2Html($txt){
$txt = str_replace(" "," ",$txt);
$txt = str_replace("<","<",$txt);
$txt = str_replace(">",">",$txt);
$txt = preg_replace("/[rn]{1,}/isU","<br/>rn",$txt);
kembalikan $txt;
}
//清除HTML标记
fungsi ClearHtml($str){
$str = str_replace('<','<',$str);
$str = str_replace('>','>',$str);
kembalikan $str;
}
//相对路径转化成绝对路径
fungsi relative_to_absolute($isi, $umpan_url) {
preg_match('/(http|https|ftp):///', $feed_url, $protocol);
$server_url = preg_replace("/(http|https|ftp|berita):///", "", $feed_url);
$server_url = preg_replace("//.*/", "", $server_url);
jika ($server_url == '') {
kembalikan $konten;
}
if (isset($protokol[0])) {
$konten_baru = preg_replace('/href="//', 'href="'.$protokol[0].$server_url.'/', $konten);
$konten_baru = preg_replace('/src="//', 'src="'.$protokol[0].$server_url.'/', $konten_baru);
} kalau tidak {
$konten_baru = $konten;
}
kembalikan $konten_baru;
}
//取得所有链接
fungsi get_all_url($kode){
preg_match_all('/<as+href=["|']?([^>"' ]+)["|']?s*[^>]*>([^>]+ )</a>/i',$kode,$arr);
return array('nama'=>$arr[2],'url'=>$arr[1]);
}
//获取指定标记中的内容
fungsi get_tag_data($str, $mulai, $akhir){
jika ( $mulai == '' || $akhir == '' ){
kembali;
}
$str = meledak($mulai, $str);
$str = meledak($akhir, $str[1]);
kembalikan $str[0];
}
//HTML Panduan Pengguna CSV
fungsi get_tr_array($tabel) {
$tabel = preg_replace("'<td[^>]*?>'si",'"',$tabel);
$tabel = str_replace("</td>",'",',$tabel);
$tabel = str_replace("</tr>","{tr}",$tabel);
//去掉 HTML 标记
$tabel = preg_replace("'<[/!]*?[^<>]*?>'si","",$tabel);
//去掉空白字符
$tabel = preg_replace("'([rn])[s]+'","",$tabel);
$tabel = str_replace(" ","",$tabel);
$tabel = str_replace(" ","",$tabel);
$tabel = meledak(",{tr}",$tabel);
array_pop($tabel);
kembalikan $tabel;
}
//将HTML Pengembalian Dana, Pengembalian Dana, dan Pengembalian Dana
fungsi get_td_array($tabel) {
$tabel = preg_replace("'<tabel[^>]*?>'si","",$tabel);
$tabel = preg_replace("'<tr[^>]*?>'si","",$tabel);
$tabel = preg_replace("'<td[^>]*?>'si","",$tabel);
$tabel = str_replace("</tr>","{tr}",$tabel);
$tabel = str_replace("</td>","{td}",$tabel);
//去掉 HTML 标记
$tabel = preg_replace("'<[/!]*?[^<>]*?>'si","",$tabel);
//去掉空白字符
$tabel = preg_replace("'([rn])[s]+'","",$tabel);
$tabel = str_replace(" ","",$tabel);
$tabel = str_replace(" ","",$tabel);
$tabel = meledak('{tr}', $tabel);
array_pop($tabel);
foreach ($tabel sebagai $key=>$tr) {
$td = meledak('{td}', $tr);
array_pop($td);
$td_array[] = $td;
}
kembalikan $td_array;
}
//返回字符串中的所有单词 $distinct=true 去除重复
fungsi split_en_str($str,$distinct=true) {
preg_match_all('/([a-zA-Z]+)/',$str,$match);
if ($berbeda == benar) {
$pertandingan[1] = array_unique($pertandingan[1]);
}
sort($cocok[1]);
kembalikan $pertandingan[1];
}