$temp_begin=strpos($content,"Received From: ip=")+18;
$temp_end=strpos($content,"port=")-1;
$log_received_from=trim(substr($content,$temp_begin,$temp_end-$temp_begin));$temp_begin=strpos("port=",$content)+5;
$temp_end=strlen($content);
$log_received_port=trim(substr($content,$temp_begin,$temp_end-$temp_begin+1));
$temp_end=strpos($content,"port=")-1;
$log_received_from=trim(substr($content,$temp_begin,$temp_end-$temp_begin));$temp_begin=strpos("port=",$content)+5;
$temp_end=strlen($content);
$log_received_port=trim(substr($content,$temp_begin,$temp_end-$temp_begin+1));
内容说明
说明: 本函式可用来开启本地或者远端的档案。若参数 filename 为 "http://......" 则本函数利用 HTTP 1.0 协定与伺服器连线,档案指标则指到伺服器传回文件的起始处。若参数 filename 为 "ftp://......." 则本函数会与伺服器连线,档案指标指到指定的档案处。若 FTP 伺服器没有支援被动模式 (passive mode ftp) 则传回失败值。开启的 FTP 档案可以是读取或写入其中之一,但不能读或写二种同时使用。其它的情形,本函式开启本地的档案,档案的指标则指向开启的档案。若开档失败,则传回 false 值。字串参数 mode 可以是下列的情形:
'r' 开档方式为唯读,档案指标指到开始处。
'r+' 开档方式为可读写,档案指标指到开始处。
'w' 开档方式为写入,档案指标指到开始处,并将原档的长度设为 0。若档案不存在,则建立新档。
'w+' 开档方式为可读写,档案指标指到开始处,并将原档的长度设为 0。若档案不存在,则建立新档。
'a' 开档方式为写入,档案指标指到档案最后。若档案不存在,则建立新档。
'a+' 开档方式为可读写,档案指标指到档案最后。若档案不存在,则建立新档。
'b' 若作业系统的文字及二进位档不同,则可以用此参数,UNIX 系统不需要使用本参数。
DO WHILE NOT FEOF(gnFileHandle)
$file = "C:\Apache\htdocs\js.txt";
line 14: $content = fopen($file, "r+")
这是什么问题?
语法: int strpos(string haystack, string needle, int [offset]);
本函数用来寻找字符串 haystack 中的字符 needle 最先出现的位置。值得注意的是 needle 只能是一个字符,中文字等就不适合了。若找不到指定的字符,则返回 false 值。