netputweets icon indicating copy to clipboard operation
netputweets copied to clipboard

相对路径的可行性

Open netputer opened this issue 12 years ago • 6 comments

今天在修复 #39 错误时,发现目前已有的函数可以做到准确获得相对路径。而基于相对路径的地址,不管是链接还是 header 跳转,都免去了判断协议的需要。

https://github.com/netputer/netputweets/commit/b503e445c6c244dee20e2a9be8207a8f82a4b776

netputer avatar Mar 11 '13 11:03 netputer

你忘了 #36 错误么...

shadowglen avatar Mar 11 '13 15:03 shadowglen

那个问题是应该路径不是 / 开头的。

我也试过了,可以在 URL Rewrite 的情况下正常获取程序根目录。

netputer avatar Mar 11 '13 15:03 netputer

我考虑的是 如果npt装在二级目录下的话 相对路径可以正常工作么?

On Mar 11, 2013, at 11:03 PM, NetPuter [email protected] wrote:

那个问题是应该路径不是 / 开头的。

我也试过了,可以在 URL Rewrite 的情况下正常获取程序根目录。

— Reply to this email directly or view it on GitHub.

shadowglen avatar Mar 11 '13 15:03 shadowglen

只要相对路径是以 / 开头就可以。

比如 xxx.com/np/tui/index.php ,那么相对路径为 /np/tui/ 即可正常工作。

On Mon, Mar 11, 2013 at 11:06 PM, Shadowglen Elf [email protected]:

我考虑的是 如果npt装在二级目录下的话 相对路径可以正常工作么?

On Mar 11, 2013, at 11:03 PM, NetPuter [email protected] wrote:

那个问题是应该路径不是 / 开头的。

我也试过了,可以在 URL Rewrite 的情况下正常获取程序根目录。

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/netputer/netputweets/issues/41#issuecomment-14718207 .

Best Regards, NetPuter Lin » http://netputer.me/

netputer avatar Mar 11 '13 15:03 netputer

嗯 这样来看的确可以用相对路径 还可以支持多域名

On Mar 11, 2013, at 11:07 PM, NetPuter [email protected] wrote:

只要相对路径是以 / 开头就可以。

比如 xxx.com/np/tui/index.php ,那么相对路径为 /np/tui/ 即可正常工作。

On Mon, Mar 11, 2013 at 11:06 PM, Shadowglen Elf [email protected]:

我考虑的是 如果npt装在二级目录下的话 相对路径可以正常工作么?

On Mar 11, 2013, at 11:03 PM, NetPuter [email protected] wrote:

那个问题是应该路径不是 / 开头的。

我也试过了,可以在 URL Rewrite 的情况下正常获取程序根目录。

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/netputer/netputweets/issues/41#issuecomment-14718207 .

Best Regards, NetPuter Lin » http://netputer.me/ — Reply to this email directly or view it on GitHub.

shadowglen avatar Mar 11 '13 15:03 shadowglen

是的,目录名是每次判断得到的。

2013/3/11 Shadowglen Elf [email protected]

嗯 这样来看的确可以用相对路径 还可以支持多域名

On Mar 11, 2013, at 11:07 PM, NetPuter [email protected] wrote:

只要相对路径是以 / 开头就可以。

比如 xxx.com/np/tui/index.php ,那么相对路径为 /np/tui/ 即可正常工作。

On Mon, Mar 11, 2013 at 11:06 PM, Shadowglen Elf [email protected]:

我考虑的是 如果npt装在二级目录下的话 相对路径可以正常工作么?

On Mar 11, 2013, at 11:03 PM, NetPuter [email protected] wrote:

那个问题是应该路径不是 / 开头的。

我也试过了,可以在 URL Rewrite 的情况下正常获取程序根目录。

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub< https://github.com/netputer/netputweets/issues/41#issuecomment-14718207> .

Best Regards, NetPuter Lin » http://netputer.me/ — Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/netputer/netputweets/issues/41#issuecomment-14718398 .

Best Regards, NetPuter Lin » http://netputer.me/

netputer avatar Mar 11 '13 15:03 netputer