【问题标题】:Symfony url for image图片的 Symfony 网址
【发布时间】:2012-03-07 23:40:05
【问题描述】:

我需要获取图像的最终 url 以将其设置为 JQuery Datepicker 输入的参数。 DatePicker 的声明方式是:

$("#myInput").datepicker({
    showOn: "button",
    buttonImage: "<url-for-the-image>",
    buttonImageOnly: true
});

我知道在 symfony 中图像位于(默认情况下)/web/images 目录中,可以使用 sfConfig::get('sf_web_dir').'/images' 访问。

问题是这个函数返回给我类似/var/www/.../web/images 而不是http://-IP-ADDRESS-/.../web/images

如何在我的图像目录中找到正确的图像 URL?非常感谢!

【问题讨论】:

    标签: php jquery image url symfony1


    【解决方案1】:

    好的,解决了!只需使用这个 Symfony 函数:image_path('my-image.png'); 这将返回图像的路径!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-22
      • 2020-12-20
      • 2020-01-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多