【问题标题】:How to override the public images directory in CakePHP?如何覆盖 CakePHP 中的公共图像目录?
【发布时间】:2010-07-14 14:19:21
【问题描述】:

/cake/config/paths.php

/** * 公共图像目录的路径。 */ 定义('IMAGES', WWW_ROOT.'images'.DS);

/** * 公共图像目录的 Web 路径。 */ if (!defined('IMAGES_URL')) { 定义('IMAGES_URL','图像/'); }

如何覆盖 /cake/config/paths.php 中设置的上述常量?我会将它们设置在 /app/config/bootstrap.php 吗?如果是这样,正确的语法是什么?

谢谢

【问题讨论】:

    标签: cakephp cakephp-1.3


    【解决方案1】:

    取决于你想如何使用它们。

    如果您将图像保存在其他位置并想使用 html->image 帮助程序,您可以简单地通过添加 /directory 来指定相对于 root 的新位置,即:

    echo $html->image('/myImages/face.jpg');
    

    【讨论】:

      猜你喜欢
      • 2023-03-31
      • 1970-01-01
      • 1970-01-01
      • 2020-11-28
      • 2017-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-27
      相关资源
      最近更新 更多