【问题标题】:PHP array display imagePHP数组显示图片
【发布时间】:2018-05-09 15:58:12
【问题描述】:

到目前为止,我如何使用 php 数组显示图片,使用 html 并不能正常工作,它只是显示字符串本身。这是我的代码:

      $output = array(  
            'order_table'       =>  $order_table,
            'cart_item'         =>  '<img src="samples/cart.png">' .count($_SESSION["shopping_cart"])
  );  

【问题讨论】:

    标签: php html arrays image output


    【解决方案1】:

    您必须在imgtag 周围添加引号,然后在php 中使用echo 显示它

     $output = array(  
                'order_table'       =>  $order_table,
                'cart_item'         =>  '<img src="samples/cart.png">' .count($_SESSION["shopping_cart"]),
      );  
    
    echo $output['cart_item']; //This will display the image
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-09-16
      • 2015-08-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-07
      • 2023-03-20
      相关资源
      最近更新 更多