ThinkPHP模板赋值

WBOY
Release: 2016-06-23 14:26:48
Original
1299 people have browsed it

thinkphp

array{
  [1] => array(1) {
    ["content"] => string(21) "20131105155309001.jpg"
  }
  [2] => array(1) {
    ["content"] => string(4) "图片"
  }
  [3] => array(1) {
    ["content"] => string(21) "20131105155309002.jpg"
  }
  [4] => array(1) {
    ["content"] => string(4) "图片"
  }
}

这样的一个数组赋值到模板,怎么把图片和文字输出?新手提问。
我要做的效果是
20131105155309001.jpg
图片
20131105155309002.jpg
图片

回复讨论(解决方案)

$arr = array(array('content'=>1),array('content'=>1),array('content'=>1),array('content'=>1));foreach($arr as $k=>$v){	echo $v['content']."<br>";}
Copy after login






这样在模板就能输出内容了,但是如果判断数组中是图片名的就用img标签,是内容就用span标签呢


ThinkPHP模板赋值">

加上实际路径。





这样在模板就能输出内容了,但是如果判断数组中是图片名的就用img标签,是内容就用span标签呢


ThinkPHP模板赋值">

加上实际路径。

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