简体   繁体   English

CakePHP 控制器/动作和图像 URL 的路径重写

[英]CakePHP Path Rewriting for controllers/actions and image URLs

I am using CakePHP.我正在使用 CakePHP。 I have relative paths for images being generated, stuff like "img/1.jpg", etc.我有生成图像的相对路径,比如“img/1.jpg”等。

I found with it sometimes when I call a certain action it redirects to a URL that ends with a /, sometimes it doesn't.我发现有时当我调用某个操作时,它会重定向到以 / 结尾的 URL,有时它不会。 So when it ends with something like: http://mysite.com/asdf/因此,当它以类似以下内容结束时: http://mysite.com/asdf/

then the image links break然后图像链接中断

when it goes to http://mysite.com/asdf当它转到http://mysite.com/asdf

the images are fine.图像很好。 How do I standardize how that last "/" is used?如何标准化最后一个“/”的使用方式? Thanks!谢谢!

For standardize You need to use HTML Helper for displaying images为了标准化您需要使用HTML Helper来显示图像

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM