php如何获取当前页地址栏的URL地址 就是我在某个网页插入了一个php链接我想获得那个网址地址地址栏的url而且要输出txt格式或其他格式。应该如何实现???还有就是写入到.txt 文件里,怎么去判断是否重复。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?php if(!file_exists("ceshi.txt")){ fopen("ceshi.txt",'w'); }$handle = fopen("ceshi.txt",'a'); $url = "http://".$_SERVER["HTTP_HOST"].(($_SERVER["SERVER_PORT"]==="80")?"":$_SERVER["SERVER_PORT"]).$_SERVER["REQUEST_URI"];echo $url."<br>";$txt = file_get_contents("ceshi.txt");if (!empty($txt)){ if (preg_match("#".$url."#",$txt)==0){ fwrite($handle,$url); }else{ echo "已存在地址"; }}else{ fwrite($handle,$url);}?> <?php if(!file_exists("ceshi.txt")){ fopen("ceshi.txt",'w'); }$handle = fopen("ceshi.txt",'a'); //获得浏览器地址$url = "http://".$_SERVER["HTTP_HOST"].(($_SERVER["SERVER_PORT"]==="80")?"":$_SERVER["SERVER_PORT"]).$_SERVER["REQUEST_URI"];echo $url."<br>";$txt = file_get_contents("ceshi.txt");//写入文件if (!empty($txt)){ if (preg_match("#".$url."#",$txt)==0){ fwrite($handle,$url); }else{ echo "已存在地址"; }}else{ fwrite($handle,$url);}?> fwrite将字符写入指定的文件$file=file_get_contents('a.txt');echo $file;$string="aaa";echo strpos($file, 'a');if(strpos($file, 'a')) { echo "你要插入的字符串已经存在";}else{ $fp=fopen("a.txt", "w+"); $string=$file.":".$string; fwrite($fp, $string);}$file=file_get_contents('a.txt');echo $file;?> fwrite将字符写入指定的文件$file=file_get_contents('a.txt');echo $file;$string="aaa";echo strpos($file, 'a');if(strpos($file, 'a')) { echo "你要插入的字符串已经存在";}else{ $fp=fopen("a.txt", "w+"); $string=$file.":".$string; fwrite($fp, $string);}$file=file_get_contents('a.txt');echo $file;?> mysql问题 PHP有关GD问题 这样一句SQL怎么写?搞了一上午了! 简单activex问题 急救php 几道简单题,有人会吗? 提供免费PHP空间,支持mysql ftp 帮忙改一下这个PHP文件。自己是在搞不定了~ 这种文件如何写 100分 微信app支付 签名失败 php snoopy采集https页面的问题 php循环中update数据,个别更新不全的问题
if(!file_exists("ceshi.txt")){
fopen("ceshi.txt",'w');
}
$handle = fopen("ceshi.txt",'a');
$url = "http://".$_SERVER["HTTP_HOST"].(($_SERVER["SERVER_PORT"]==="80")?"":$_SERVER["SERVER_PORT"]).$_SERVER["REQUEST_URI"];
echo $url."<br>";
$txt = file_get_contents("ceshi.txt");
if (!empty($txt)){
if (preg_match("#".$url."#",$txt)==0){
fwrite($handle,$url);
}else{
echo "已存在地址";
}
}else{
fwrite($handle,$url);
}
?>
if(!file_exists("ceshi.txt")){
fopen("ceshi.txt",'w');
}
$handle = fopen("ceshi.txt",'a');
//获得浏览器地址
$url = "http://".$_SERVER["HTTP_HOST"].(($_SERVER["SERVER_PORT"]==="80")?"":$_SERVER["SERVER_PORT"]).$_SERVER["REQUEST_URI"];
echo $url."<br>";
$txt = file_get_contents("ceshi.txt");
//写入文件
if (!empty($txt)){
if (preg_match("#".$url."#",$txt)==0){
fwrite($handle,$url);
}else{
echo "已存在地址";
}
}else{
fwrite($handle,$url);
}
?>
$file=file_get_contents('a.txt');
echo $file;
$string="aaa";
echo strpos($file, 'a');
if(strpos($file, 'a')) {
echo "你要插入的字符串已经存在";
}else{
$fp=fopen("a.txt", "w+");
$string=$file.":".$string;
fwrite($fp, $string);
}
$file=file_get_contents('a.txt');
echo $file;
?>
$file=file_get_contents('a.txt');
echo $file;
$string="aaa";
echo strpos($file, 'a');
if(strpos($file, 'a')) {
echo "你要插入的字符串已经存在";
}else{
$fp=fopen("a.txt", "w+");
$string=$file.":".$string;
fwrite($fp, $string);
}
$file=file_get_contents('a.txt');
echo $file;
?>