【问题标题】:how do you echo input tag of type image and get to load image in codeigniter?你如何回显图像类型的输入标签并在codeigniter中加载图像?
【发布时间】:2012-12-11 15:39:30
【问题描述】:

我正在尝试回显图像类型的提交按钮输入标记,但我无法让它加载图像,它存储在我网站的 public_html 目录中名为 imgs 的目录中。我的代码是这样的:

echo '<input type="image" src="'.base_url("img/sign_up_0.png").'">';

我已经自动加载了 url helper 并使用它来以相同的方式加载链接中的图像。

【问题讨论】:

    标签: php codeigniter


    【解决方案1】:

    试试这个:

     $image_path = base_url()."imgs/sign_up_0.png";
     echo '<input type="image" src="'.$image_path.'">';
    

    【讨论】:

    • 只是一种更清洁的方法:$image_path = base_url()."img/sign_up_0.png"; echo "&lt;input type='image' src='{$image_path}' /&gt;";
    • 如果你用firebug(for firefox)检查并查看图像,你可以看到路径,对吗?控制台返回一些错误?
    • 我已经检查了路径,没错,这是我检查的第一件事
    • 如果路径正常,则必须查看图像。您的浏览器没有错误?我们可以查看您的页面来检查问题吗?
    • 如果你用我的代码更改你可以看到图像?放好后,问题是看不出来的图片是否正确
    猜你喜欢
    • 2012-06-24
    • 2013-09-10
    • 1970-01-01
    • 1970-01-01
    • 2012-06-24
    • 2012-11-07
    • 2020-08-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多