0

I build

define('SITE_URL', siteURL()); //returns http://example.com/dir/
define('CKEDITOR', SITE_URL.'plugins/ckeditor/ckeditor.js');

What is the string operation to find the 'difference' between the SITE_URL and the full URL aka http://example.com/dir/plugins/ckeditor/ckeditor.js so that I only return the plugins/ckeditor/ckeditor.js part?

4

2 回答 2

2
str_replace($site_url, '', $fullurl);
于 2013-06-22T13:42:55.420 回答
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

于 2013-06-22T13:54:06.197 回答