【发布时间】:2015-12-13 08:10:01
【问题描述】:
我正在尝试仅从数据库中获取图像。在数据库中,表(post_content)有图像以及我只想要图像的描述。可能吗?请记住,$row['post_content'] 具有图像和说明。
<?php
$sql = "select * from wp_tableposts;";
$res = mysql_query($sql);
while ($row = mysql_fetch_array($res))
{
echo'Post Contant:'. $row['post_content']. '';
}
?>
【问题讨论】:
-
如果你的表中没有图片的特殊字段,那么你必须解析
post_content -
请详细说明我不懂解析
post_content -
他可能正在考虑使用/破坏
$row['post_content']和pathinfo($row['post_content'])或类似功能。看看 php.net 手册页上的pathinfo()函数。 -
请提供 post_content 中的数据示例,以及该示例所需的结果。
-
此数据来自数据库
<img class="alignnone size-medium wp-image-8" src="http://localhost/wordpress/wp-content/uploads/2015/12/1977417_1380086445598132_747645780_n-225x300.jpg" alt="1977417_1380086445598132_747645780_n" width="225" height="300" />this is description