PHP数组显示图像
如何使用php数组显示图片?到目前为止,使用html无法显示图片,它只是显示字符串本身。以下是我的代码:PHP数组显示图像,php,html,arrays,image,output,Php,Html,Arrays,Image,Output,如何使用php数组显示图片?到目前为止,使用html无法显示图片,它只是显示字符串本身。以下是我的代码: $output = array( 'order_table' => $order_table, 'cart_item' => '<img src="samples/cart.png">' .count($_SESSION["shopping_cart"]) );
$output = array(
'order_table' => $order_table,
'cart_item' => '<img src="samples/cart.png">' .count($_SESSION["shopping_cart"])
);
$output=数组(
“订单表格”=>$order表格,
'cart\u item'=>''。计数($\会话[“购物车”])
);
您必须在img
标记周围添加引号,然后使用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
$output=数组(
“订单表格”=>$order表格,
'cart\u item'=>''.count($\u会话[“购物车]),
);
echo$output['cart_item']//这将显示图像
您必须在img
标记周围添加引号,然后使用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
$output=数组(
“订单表格”=>$order表格,
'cart\u item'=>''.count($\u会话[“购物车]),
);
echo$output['cart_item']//这将显示图像