我想什么可能是处理内部链接的最佳方式。
目前,我只是将完整的 URL 粘贴到所见即所得编辑器中,并在将内容插入数据库之前将其替换为占位符。
ROOT_URL = "http://localhost/projectname/";
$content = Helper::replace_all(ROOT_URL, "{{{ROOT_URL}}}", $content); // custom
在输出内容之前,占位符被当前的 ROOT_URL 替换。
$content = Helper::replace_all("{{{ROOT_URL}}}", ROOT_URL, $content); // custom
它工作正常,但我想知道你的最佳做法。你会如何处理这个问题?
提前致谢!