我建立
define('SITE_URL', siteURL()); //returns http://example.com/dir/
define('CKEDITOR', SITE_URL.'plugins/ckeditor/ckeditor.js');
在SITE_URL
和full URL
又名http://example.com/dir/plugins/ckeditor/ckeditor.js
之间查找'差异'的字符串操作是什么,以便我只返回{{1部分?
答案 0 :(得分:2)
str_replace($site_url, '', $fullurl);
答案 1 :(得分:0)
这是你的答案
function siteURL()
{
return "http://example.com/dir/";
}
define('SITE_URL', siteURL()); //returns http://example.com/dir/
define('CKEDITOR', SITE_URL.'plugins/ckeditor/ckeditor.js');
// ignore the previous code is just to emulate your constants and functions
// the answer is the following line:
echo str_replace(SITE_URL,'',CKEDITOR);
这里的工作示例:http://3v4l.org/svTYm