【PHP】実践関数3_PHPチュートリアル
empty
php
s
url
コード
関数
コピー
実用的
の
URL
脚本
得る
// 現在のスクリプトの URL を取得します
コードをコピーします コードは次のとおりです:
function get_php_url(){
$_SERVER[" REQUEST_URI"]; $nowurl if(empty($_SERVER[" QUERY_STRING"])) $nowurl = $scriptName;
nowurl = $scriptName."?".$_SERVER[" _STRING"];
nowurl コードは次のとおりです:
function 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;
}
//削除HTML タグ
コードをコピー コードは次のとおりです:
function Text2Html($txt){
$txt = str_replace(" "," ,$txt) ;
rn]{1,}/isU ","
rn",$txt);
アウトアウトアウトアウトアウトライトアウトストレートアウト一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に一緒に右に一緒に右に右にアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトアウトそうそうそうそうそうそうそうそうそうそうそうそうそう、皆さんは function ClearHtml($str){
use using using -
//相対パスを絶対パスに変換します コードをコピーします
コードは次のとおりです:
function 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 == '') {
return $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);
} else {
$new_content = $content;
}
$new_content を返す;
}
//すべての链接を取得
function get_all_url($code){
preg_match_all('/"' ]+)["|']?s*[^>]*>([^>]+)/i',$code,$arr);
return array('name'=>$arr[2],'url'=>$arr[1]);
}
//HTML表格の每行转はCSV格式数组
function get_tr_array($table) {
$table = preg_replace("']*?>'si",'"',$table);
$table = str_replace(" ",'",',$table);
$table = str_replace("","{tr}",$table);
function get_tr_array ($table) {
$table = preg_replace("']*?>'si",'"',$table);
$table = str_replace(" ",'",',$table);
$table = str_replace("","{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);
return $table;
}
// HTML表格の実行列转是数组,取集表格データデータ
function get_td_array($table) {
$table = preg_replace("']*?>'si","",$table);
function 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 == '') {
return $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);
} else {
$new_content = $content;
}
$new_content を返す;
}
//すべての链接を取得
复制代码代码如下:
function get_all_url($code){
preg_match_all('/
return array('name'=>$arr[2],'url'=>$arr[1]);
}
//HTML表格の每行转はCSV格式数组
复制代代码如下:
function get_tr_array($table) {
$table = preg_replace("'
$table = str_replace("
$table = str_replace("","{tr}",$table);
function get_tr_array ($table) {
$table = preg_replace("'
$table = str_replace("
$table = str_replace("","{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);
return $table;
}
// HTML表格の実行列转是数组,取集表格データデータ
复制代代码如下:
function get_td_array($table) {
$table = preg_replace("'
]*?>'si","",$table); $table = str_replace(" |