我正在为一个项目创建一个零售网站。
如何使阵列显示图像真正的零售网站?例如,4行图像整齐排列在一行之后。
<?php
$navItems = array (
array(
'slug' => "index.php",
'title' => "Home"
),
array(
'slug' => "menu.php",
'title' => "Menu"
),
array(
'slug' => "contact.php",
'title' => "Contact"
),
);
$menuItems = array(
"club-sandwich" => array(
"name" => "Club Sandwich",
"price" => 11,
"blurb" => "Bacon ipsum dolor sit amet fatback landjaeger ullamco pariatur. Nostrud laboris et, duis drumstick eiusmod kevin ut aliquip. Filet mignon short ribs tenderloin short loin kielbasa non pork chop aliqua. Jerky shank tri-tip capicola, non andouille tenderloin cupidatat turducken meatball pork beef eu shoulder jowl.",
"drink" => "Club Soda"
),
"dill-salmon" => array(
"name" => "Lemon & Dill Salmon",
"price" => 18,
"blurb" => "Pork belly tempor ground round qui exercitation, jowl leberkas sed voluptate excepteur jerky. Reprehenderit veniam cow, quis in ribeye andouille eu pastrami eiusmod exercitation dolor.",
"drink" => "Fancy Wine"
),
"super-salad" => array(
"name" => "The Super Salad<sup>®</sup>",
"price" => 34,
"blurb" => "Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.",
"drink" => "Jug o' Water"
),
"mexican-barbacoa" => array(
"name" => "Mexican Barbacoa",
"price" => 23,
"blurb" => "I love fruitcake danish caramels. Tart danish pastry liquorice chocolate cake fruitcake. Bear claw gingerbread muffin I love apple pie apple pie tiramisu brownie chocolate. Sweet roll cotton candy cupcake gingerbread gummies jelly-o. Muffin I love croissant I love jelly-o brownie jelly beans. Toffee I love pastry.",
"drink" => "Beer with a lime"
),
);
?>
我认为将图像指定为数组的一部分,但它不起作用。
<?php
$navItems = array (
array(
'slug' => "index.php",
'title' => "Home"
),
array(
'slug' => "menu.php",
'title' => "Menu"
),
array(
'slug' => "contact.php",
'title' => "Contact"
),
);
$menuItems = array(
"club-sandwich" => array(
"name" => "Club Sandwich",
"price" => 11,
"blurb" => "Bacon iort loin kielbasa non pork chop aliqua. Jerky shank tri-tip capicola, non andouille tenderloin cupidatat turducken meatball pork beef eu shoulder jowl.",
"drink" => "Club Soda"
"image" => <img src="hr.png">
),
"dill-salmon" => array(
"name" => "Lemon & Dill Salmon",
"price" => 18,
"blurb" => "Pork belly tempor ground round qui exercitation, jowl leberkas sed voluptate excepteur jerky. Reprehenderit veniam cow, quis in ribeye andouille eu pastrami eiusmod exercitation dolor.",
"drink" => "Fancy Wine"
"image" => <img src = "hr.png">
),
"super-salad" => array(
"name" => "The Super Salad<sup>®</sup>",
"price" => 34,
"blurb" => "Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.",
"drink" => "Jug o' Water"
"image" => <img src = "hr.png">
),
"mexican-barbacoa" => array(
"name" => "Mexican Barbacoa",
"price" => 23,
"blurb" => "I love fruitcake danish caramels. Tart danish pastry liquorice chocolate cake fruitcake. Bear claw gingerbread muffin I love apple pie apple pie tiramisu brownie chocolate. Sweet roll cotton candy cupcake gingerbread gummies jelly-o. Muffin I love croissant I love jelly-o brownie jelly beans. Toffee I love pastry.",
"drink" => "Beer with a lime"
"image" => <img src = "hr.png">
),
);
?>
答案 0 :(得分:0)
使用html Image标签。在数组中插入图像的URL和打印全部。
<?php $filenames=scan_dir($path); ?>
如果你想从你的文件夹中获取图像,只需将所有图像放在一个目录中,然后列出所有文件(这将是图像)并将它们的路径保存在你的阵列中并按照我之前告诉你的方式进行操作。
pandas.read_csv