- 论坛徽章:
- 14
|
- <?php
- $arr = array("a"=>"%as:nd","b"=>"as~bz3","c"=>"a,s%cd","d"=>"m9~7cd","e"=>"xbs%ka");
- $file=file_get_contents('200.txt');
- $str = preg_split('/[ ]+/', trim($file));
- for ($i=0; $i <count($str) ; $i++) {
- if(strpos($str[$i], "%")===false && strpos($str[$i], "!")===false){
- foreach (preg_split('//', $str[$i]) as $key => $value) {
- if(array_key_exists($value,$arr)) $str[$i]=str_replace($value, $arr[$value], $str[$i]);
- }
- }
- echo $str[$i]." ";
- }
- ?>
- 结果:
- You'll plxbs%kanty of mxbs%k%as:nd%as:ndn~s of rxbs%k%as:nd%as:nda,s%cd,hing w%-hat txbs%kay trb%cks onxbs%ka in your bow! On top of th%as:ndt, Just !about %as:ndny, Any timxbs%ka you bo!nk, Lxbs%k%as:nd%as:ndvxbs%k%as:nd hxbs%kar with %as:nd per%son's a,s%cdontrols [Finished in 0.5s]
复制代码 |
|