帮小弟我看下这ARRAY错哪了

WBOY
Release: 2016-06-13 11:43:34
Original
841 people have browsed it

帮我看下这ARRAY哪里错了



function replace_text_wps($text){
$replace = array(
// '关键词' => '替换的关键词'
'wordpress' => 'wordpress');
$tmpfilename='1.txt';//格式为prom|http://www.baidu.com
$str = file_get_contents($tmpfilename);//获得内容  
$arr = explode("\n",$str);//分行存入数组  
foreach($arr as $row){//遍历每行  
      $keys=explode("|",$row);
  $replace[$keys[0]]=$keys[1];   //这里为什么没有成功添加进去呢
}


$replace['excerpt'] = 'cool';
$text = str_replace(array_keys($replace), $replace, $text);
return $text;
}
echo replace_text_wps('prom dresses wordpress excerpt');
?>

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template