Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 在cakephp中将图像添加到登录页面_Html_Css_Cakephp - Fatal编程技术网

Html 在cakephp中将图像添加到登录页面

Html 在cakephp中将图像添加到登录页面,html,css,cakephp,Html,Css,Cakephp,我正在用cakephp创建一个登录页面。我没有写“登录”,而是想显示一个图像。我就是这样尝试的: <br> <div class="index large-4 medium-4 large-offset-4 medium-offset-4 columns"> <div class="panel"> <h2 class="text-center"><img src="img/cake.icon.png" /><

我正在用cakephp创建一个登录页面。我没有写“登录”,而是想显示一个图像。我就是这样尝试的:

<br>
<div class="index large-4 medium-4 large-offset-4 medium-offset-4 columns">
    <div class="panel">
        <h2 class="text-center"><img src="img/cake.icon.png" /></h2>
        <?= $this->Form->create(); ?>
            <?= $this->Form->input('email'); ?>
            <?= $this->Form->input('password', array('type' => 'password')); ?>
            <?= $this->Form->submit('Login', array('class' => 'button')); ?>
        <?= $this->Form->end(); ?>
    </div>
</div>


在上面的布局中,我尝试添加一个图像
logo.png
,而不是显示“Login”。但是,图像没有加载。我已将图像放置在webroot/img/logo.png中。但是,图像没有加载。这个怎么了?我应该更改或添加什么?

将src更改为使用logo.png而不是cake.icon.png

<img src="img/logo.png" />

您应该参考以下文档:

试试这个:

<h2 class="text-center">
  <?php echo $this->Html->image('logo.png'); ?>
</h2>

要解决此问题,您需要确定页面未加载图像的原因。确保您可以通过/img/logo.png访问图像-如果您可以在浏览器中加载图像,请在加载页面时按f12,查看页面尝试加载图像时返回的状态代码