Home > Backend Development > PHP Tutorial > PHP 分页.图片分隔数组.

PHP 分页.图片分隔数组.

WBOY
Release: 2016-06-23 14:20:59
Original
1013 people have browsed it

本帖最后由 gencc 于 2013-09-04 14:49:17 编辑

数组 分页 php

<img  src="1.jpg" alt="PHP 分页.图片分隔数组." ><br />这张图片太搞笑了<br /><img  src="2.jpg" alt="PHP 分页.图片分隔数组." ><br />这张图片太可怕了<br /><img  src="3.jpg" alt="PHP 分页.图片分隔数组." ><br />笑傻了.
Copy after login


将这些数据转为两个数组.
图片数组和文字数组


回复讨论(解决方案)

$s = <<< TXT<img  src="1.jpg" alt="PHP 分页.图片分隔数组." ><br />这张图片太搞笑了<br /><img  src="2.jpg" alt="PHP 分页.图片分隔数组." ><br />这张图片太可怕了<br /><img  src="3.jpg" alt="PHP 分页.图片分隔数组." ><br />笑傻了.TXT;$t = explode('
'.PHP_EOL, $s);foreach(array_chunk($t, 2) as $row) { list($图片[], $文字[]) = $row;}print_r($图片);print_r($文字);
Copy after login
Copy after login
Array
(
[0] => PHP 分页.图片分隔数组.
[1] => PHP 分页.图片分隔数组.
[2] => PHP 分页.图片分隔数组.
)
Array
(
[0] => 这张图片太搞笑了
[1] => 这张图片太可怕了
[2] => 笑傻了.
)

$s = <<< TXT<img  src="1.jpg" alt="PHP 分页.图片分隔数组." ><br />这张图片太搞笑了<br /><img  src="2.jpg" alt="PHP 分页.图片分隔数组." ><br />这张图片太可怕了<br /><img  src="3.jpg" alt="PHP 分页.图片分隔数组." ><br />笑傻了.TXT;$t = explode('
'.PHP_EOL, $s);foreach(array_chunk($t, 2) as $row) { list($图片[], $文字[]) = $row;}print_r($图片);print_r($文字);
Copy after login
Copy after login
Array
(
    [0] => PHP 分页.图片分隔数组.
    [1] => PHP 分页.图片分隔数组.
    [2] => PHP 分页.图片分隔数组.
)
Array
(
    [0] => 这张图片太搞笑了
    [1] => 这张图片太可怕了
    [2] => 笑傻了.
)

PHP 怎么将那些代码处理成这样呢?

哎,但很多代码都不同的.有多个
的.

explode('PHP 分页.图片分隔数组.'.PHP_EOL, $s);
这个怎么写呢,用图片分隔开来.

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