私はテーブル内にブートストラップモーダルを使用しています。そのモーダルでは画像を表示したいのですが、そのソースは反復して取得する配列にあります。しかし、絵はこれが私のコードPHPでループ内のimgタグにソースを提供するには
<table class='table table-hover table-responsive' width='21' id='tableHayatcomputers'>
<caption>Hayat Computers</caption>
<?php foreach($hayatcomputers as $hc){ ?>
<tr>
<td><?php echo $hc['name'] ?></td>
<td><?php echo $hc['price'] ?></td>
<td><div class="container">
<h2>Modal Example</h2>
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#myModal">Open Modal</button>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
Details
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<img src="<?php preg_replace('/\s+/', '%20',$hc['image'])?>" class="img-thumbnail" alt="Cinque Terre" width="304" height="236"></img>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</td>
</tr>
<?php } ?>
</table>
です...
は表示されません私は、任意の参照が不足しているだろうか?そして、なぜイメージが反復されていませんが、名前と価格が反響する
array (size=2)
0 =>
array (size=4)
'name' => string ' Nvidia Geforce STRIX-GTX970-DC2OC-4GD5 GTX 970' (length=47)
'price' => string '
Rs. 43,800 Ex Tax: Rs. 43,800
' (length=64)
'link' => string 'http://www.hayatcomputers.com/index.php?route=product/product&product_id=1551&search=GTX+970' (length=92)
'image' => string 'http://www.hayatcomputers.com/image/cache/data/Nvidia Geforce/11-200x236.jpg' (length=76)
1 =>
array (size=4)
'name' => string 'NVIDIA GeForce GTX 970' (length=22)
'price' => string '
Rs. 43,000 Ex Tax: Rs. 43,000
' (length=64)
'link' => string 'http://www.hayatcomputers.com/index.php?route=product/product&product_id=794&search=GTX+970' (length=91)
'image' => string 'http://www.hayatcomputers.com/image/cache/data/Graphics Cards/NVIDIA GeForce GTX 970 Rev 1.1-200x236.jpg' (length=105)
は?=にpreg_replace( '/ \ S + < '<?phpのエコーにpreg_replace( '/ \ S + /'、 '%20'、$のHC [ '画像'])>'結果をエコー 'OR/'、'%20 '、$ hc [' image '])?>' –
OMG !!!ああ、神様!!! OMGGGG !!!!!!!!!!!!!!!!!そのすべてのスキルは粉砕された!これはあなたが8時間まっすぐにコードするときに起こります! –
今日は十分なプログラミング!すべてありがとうございました –