开发者

How to link images in kohana?

I'm getting started using Kohana framework. How do I properly link images? I'm linking images using the usual way:

<img 开发者_如何学编程src="../../resources/images/img01.jpg" />

I'm using dreamweaver, and I can see that the link is correct. Since I can see an image in the preview:

How to link images in kohana?

The link is still the same when I reference the image based on the controller.


Best way to use full (base)paths:

<img src="<?php echo url::base() ?>resources/images/img01.jpg" />

or:

<img src="<?php echo url::site('resources/images/img01.jpg') ?>" />


You need to use absolute links. Either use html::image(), or prefix your image with url::base(), or use url::site(). There's lots of options, read the documentation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜