<view hidden="{{currentTab!==0}}">
<view wx:for=’{{logs}}’>
<view>{{logs.pcontent}}</view>
<view>
<image wx:for=’{{logs.ppic}}’ wx:for-index=“index” wx:for-item=‘picPath’ src=’{{picPath.src}}’></image>
<!-- <image src=’{{logs.ppic[item]}}’></image> -->
</view>
<view>{{logs.pdate}}</view>
</view>
</view>
上面的logs.pcontent可以显示 然而image src='{{logs.ppic}}'显示不出图片
我的php是这样的 是不是php中 ppic有问题?
<?php
header(“Content-Type:application/json;charset=UTF-8”);
$uphonenumber = $_POST[‘phonenumber’];//post获得手机号码表单值
$json = ‘’;
$data = array();
include(‘init.php’);//链接数据库
//$sql = “SELECT * FROM yffice_project where uphonenumber = $uphonenumber”;
$sql = “SELECT * FROM yffice_project where uphonenumber = $uphonenumber”;
mysql_query(“set names utf8”);
$result = mysql_query($sql);//执行sql
if($result){
//echo “查询成功”;
while ($row = mysql_fetch_array($result))
{
$data[“uid”]=$row[“uid”];
$data[“pcontent”]=$row[“pcontent”];
$data[“ppic”]=explode(",",$row[“ppic”]);
$data[“pdate”]=$row[“pdate”];
$data[“pweek”]=$row[“pweek”];
$data[“pweather”]=$row[“pweather”];
}
$json=json_encode($data);
echo $json;
}else{
echo “查询失败”;
}
mysql_close();//关闭数据库
?>
我php返回的值是这样的
<view wx:for=’{{logs.src}}’>
<image src=“https://yffice.com{{logs.src[index]}}” class=“slide-image” />
</view>
这样写就可以了