Home  >  Article  >  Backend Development  >  php中使用explode查找某个字符是否存在的方法_PHP

php中使用explode查找某个字符是否存在的方法_PHP

WBOY
WBOYOriginal
2016-06-01 12:14:47879browse

这个方法同样可以用于判断是否有该分隔符号。例如:
复制代码 代码如下:
if($_MODULE[tg1_tjly]){
$tg1_tjly = explode("|",$_MODULE[tg1_tjly]);
if(count($tg1_tjly)>1){ //重点在这里,统计数组大于1的时候则说明含有1个或以上的间隔符号“|”。
$tg1_tjly_tit = $tg1_tjly[0];
$tg1_tjly_con = $tg1_tjly[1];
}else{
$tg1_tjly_tit = '推荐理由';
$tg1_tjly_con = $_MODULE[tg1_tjly];
}
}else{
$tg1_tjly_tit = '输入推荐理由标题';
$tg1_tjly_con = '输入推荐理由内容,请输入推荐理由内容,请输入推荐理由内容。';
}
?>

Statement:
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