我正在用HTML编写php代码。现在我得到一个我无法追踪的解析错误!有人可以帮我修复它吗
echo '<a href="'.base_url('uploads/files/'.$file['file_name']).'">
<img src="echo base_url('uploads/files/'.$file['file_name'])">
<p>Uploaded On '.date("j M Y",strtotime($file['created'])).'</p>';
错误: - 解析错误:语法错误,意外“上传”(T_STRING),期待','或';'
答案 0 :(得分:0)
echo '<a href="'.base_url('uploads/files/'.$file['file_name']).'">
<img src="'.base_url('uploads/files/'.$file['file_name']).'">
<p>Uploaded On '.date("j M Y",strtotime($file['created'])).'</p>';
答案 1 :(得分:0)
一步一步
$bu = base_url('uploads/files/'.$file['file_name']);
$d = date("j M Y",strtotime($file['created']));
echo '<a href="'.$bu.'"><img src="'.$bu.'"/><p>Uploaded On '.$d.'</p></a>';
防止拼写错误和语法错误
注意:添加了遗失</a>
答案 2 :(得分:-1)
制作如下的var:
$linkToImg = base_url('uploads/files/'.$file['file_name']);
$uploadDate = date('j M Y',strtotime($file['created']));
echo "<a href='". $linkToImg ."'>";
echo "<img src='". $linkToImg ."'>";
echo "<p>Uploaded On ". $uploadDate ."</p>";
echo "</a>"; // Don't forget to close <a> tag