+ -
当前位置:首页 → 问答吧 → 帮小弟我看一下这句代码。。

帮小弟我看一下这句代码。。

时间:2010-09-28

来源:互联网

原始代码:<?php
  if (zen_not_null($products_image)) {
  ?>

如果$products_image=1.jpg

我现在想让它表现出,如果1.jpg没有,则显示为1-1.jpg

应该怎么写。。。。。在线等。。。

作者: gaihaihao   发布时间: 2010-09-28


if($products_image=='1.jpg'){
    $img = $products_image;
}else{
   $str = explode(".",$products_image);
   $img = $str[0]."-1".$str[1];
}

作者: jessy   发布时间: 2010-09-28

有个小错误 下面改了下
$img = $str[0]."-1.".$str[1];

作者: jessy   发布时间: 2010-09-28

相关阅读 更多