使用框架可以轻松地列出html src和href属性的完整url,相对路径与之相比更加全面。但是这样做更快吗?是否会产生额外的DNS查询?当内容在同一服务器上时,最佳实践是什么?
<img src='http://site.com/images/img1.png' />
与
<img src='/images/img1.png' />
Codeigniter的图像辅助函数img()的使用方法类似于用户指南中的这个:
echo img('images/picture.jpg');
// gives <img src="http://site.com/images/picture.jpg" />
Codeigniter的anchor助手anchor()的用法类似于用户指南中的此链接:
echo anchor('news/local/123','My News');
// gives <a href="http://example.com/index.php/news/local/123" >My News</a>