How to use explode in php to find whether a certain character exists

高洛峰
Release: 2023-03-01 12:54:01
Original
1045 people have browsed it

The code is as follows:

<?php 
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 = &#39;推荐理由&#39;; 
$tg1_tjly_con = $_MODULE[tg1_tjly]; 
} 
}else{ 
$tg1_tjly_tit = &#39;输入推荐理由标题&#39;; 
$tg1_tjly_con = &#39;输入推荐理由内容,请输入推荐理由内容,请输入推荐理由内容。&#39;; 
} 
?>
Copy after login


Related labels:
php
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!