本帖最后由 lyf091 于 2014-10-19 12:14:29 编辑 直接上代码
'si,,$arr[0]);
$output = preg_replace(']*?>'si,,$output);
$output = preg_replace(']*?>'si,,$output);
$output = preg_replace(']*?>'si,,$output);
$output = preg_replace(' 'si,,$output);
$output = preg_replace(''si,,$output);
$output = str_replace(
,{tr},$output);
$output = str_replace(\t,,$output);
$output = str_replace( ,,$output);
$output = preg_replace('/ /',,$output);
$output = preg_replace(''si,,$output);
$output = explode('{tr}', $output);
array_pop($output); //去除数组最后一个空元素
foreach ($output as $key => $value) {
$value = trim($value);
$temp = explode(\r\n,$value);
$output[$key] = $temp;
}
array_shift($output);
print_r($output);
exit;
$smarty->assign('arr',$output); //数组定义模板
$smarty->display('lib.html');
?>
想要去除红字的元素
array
(
[0] => array
(
[0] => 1
[1] => 天才少年维克多
[2] => (美) 乔辛·迪·波沙达, 雷蒙德·乔伊著
[3] => 南海出版公司2014.06
[4] => i712.45/965
[5] => 中文图书
)
[1] => array
(
[0] => 2
[1] => 维特根斯坦传:天才之为责任.插图本
[2] => (英) 瑞·蒙克著
[3] => 浙江大学出版社2014.04
[4] => b561.59/14
[5] => 中文图书
)
)
分不多,全给了,十分感谢!
------解决思路----------------------
foreach($output as $k => $v) {
unset($output[$k][2], $output[$k][3]);
}
