发新话题
打印

有关PHP的函数explode问题

有关PHP的函数explode问题

以下的这个例子:
function cut($file,$from,$end){

$message=explode($from,$file);
$message=explode($end,$message[1]); //这里的$message[1]是什么意思,哪里来的
return $message[0]; //这里的$message[0]是什么意思,哪里来的
}
function updatecache($file,$cache=''){ //这里的$cache=''是什么意思,有什么作用
global $timestamp,$flush;
if(!file_exists($file)){
writetofile($file,$cache);
$return=$cache;
}elseif(@filemtime($file) < $timestamp - ($flush * 60)){ //这里的@起什么作用,意思是什么
writetofile($file,$cache);
$return=$cache;
}else{
$return=readfromfile($file);
}
return $return;
}

TOP

$message=explode($from,$file);
这句之后不就有了$message变量了吗?而且是个数组,这不就有了$message[1]了

@的意思是不提示错误信息

TOP

复制内容到剪贴板
代码:

<?PHP

function cut($file,$from,$end){ 



$message=explode($from,$file);   //字符串被分割成两个元素的数组

$message=explode($end,$message[1]); //数组从0开始的,

return $message[0]; //同上



function 
updatecache($file,$cache=''){ //可选参数 

global $timestamp,$flush

if(!
file_exists($file)){ 

writetofile($file,$cache); 

$return=$cache

}elseif(@
filemtime($file) < $timestamp - ($flush 60)){ //这里的@抑制错误报告 

writetofile($file,$cache); 

$return=$cache

}else{ 

$return=readfromfile($file); 



return 
$return

}
?>

[ 本帖最后由 chris 于 2008-2-22 17:03 编辑 ]
广告位招租。

TOP

发新话题