本文介绍了我们应该使用< base href ="“" /&GT ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我总是通过mod_rewrite和PHP路由将所有请求发送给PHP。所以我所有的链接都是绝对的,例如 / about / something 。




 < a href =<?php echo BASE;?>>家< / a> 

其中 BASE 一般转换为<$ c

我记得给< base href = / 或根据基本网址可能会有所不同。 <?php echo BASE;?> /> a之前,但我不记得为什么我停止使用它(我认为这让我很头疼)。



使用这个元素有问题吗?

解决方案

我总是使用base href出于同样的原因;我使用mod_rewrite将url转换为查询字符串,我不想在整个地方使用绝对URL。所以我把一个基础href放在顶部。从来没有任何真正的问题。


I always send all my requests to PHP via mod_rewrite and route using PHP. So all my links are absolute, i.e. /about/something.

I usually write my links like so...

<a href="<?php echo BASE; ?>">home</a>

Where BASE generally translates to / or could be different depending on the base URL.

I remember giving <base href="<?php echo BASE; ?>" /> a go before, but I can't remember why I stopped using it (I think it was giving me headaches).

Are there problems with using this element?

解决方案

I always use base href for the same reason; I use mod_rewrite to make the url into a query string and I don't want to use absolute urls all over the place. So I put one base href at the top. Never had any real issues with it.

这篇关于我们应该使用&lt; base href =&quot;“&quot; /&GT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 13:06
查看更多