Home > Backend Development > PHP Tutorial > 回来字符串截取循环

回来字符串截取循环

WBOY
Release: 2016-06-13 12:29:46
Original
736 people have browsed it

返回字符串截取循环
$return 返回值为
 9||50
||1|#|2013-09-09 00:00:22||13814002394||内容
||1|#|2013-09-09 00:00:19||13814002394||内容
||1|#|2013-09-07 00:51:57||15920531400||内容
||1|#|2013-09-06 22:21:02||15920531400||内容
||1|#|2013-09-06 22:13:14||15920531400||内容
||1|#|2013-09-06 22:07:42||15920531400||内容
||1|#|2013-09-05 14:00:02||15920531400||内容
||1|#|2013-09-05 12:10:13||15920531400||内容
||1|#|2013-09-05 12:01:27||15920531400||内容
||1|#|

//这是整理过的

是有规则的字符串(不是数组)
我变成可循环的数组 其中时间,号码,内容是变量!!!!!

1592053140015920531400138140023942013-09-06 22:21:0215920531400内容

<?php<br />
	$str='91592053140015920531400#内容<br />
	2013-09-05 14:00:022013-09-06 22:13:14内容<br />
	#113814002394#2013-09-05 12:01:272013-09-07 00:51:5711#内容<br />
	#50<br />
	','内容<br />
	2013-09-05 12:10:13#1';<br />
	$new_str=str_replace('11#12013-09-09 00:00:22内容<br />
	',$new_str);<br />
	$new_arr=array();<br />
	foreach ($arr as $value) <br />
	{<br />
		echo $value;<br />
		if (substr_count($value,'内容<br />
	1',$str);<br />
	$arr=explode('2013-09-06 22:07:4215920531400##2013-09-09 00:00:1915920531400',$value);<br />
		}<br />
	}<br />
	echo "<pre class="brush:php;toolbar:false">";<br />
	print_R($new_arr);<br />
	echo "
Copy after login
";
?>
简单的写了下,凑合着能,不知道有没有什么更好的办法
Copy after login
')>1) 
{
$new_arr[]=explode('内容
1内容
1#1#

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