Home  >  Article  >  Backend Development  >  ThinkPHP模板赋值

ThinkPHP模板赋值

WBOY
WBOYOriginal
2016-06-23 14:26:481292browse

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>";}






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


ThinkPHP模板赋值">

加上实际路径。





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


ThinkPHP模板赋值">

加上实际路径。

++1

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
Previous article:PHP Sphinx 搜索Next article:对单例对象的一点疑惑