我有以下代码:
VM364:1 POST https://<my-website>/wp-admin/admin-ajax.php?action=ai1wm_import 404 (Not Found)
(anonymous) @ VM364:1
send @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils&ver=5.2.4:4
ajax @ load-scripts.php?c=0&load[]=jquery-core,utils&ver=5.2.4:4
FileUploader.upload @ import.min.js?v=7.9&ver=5.2.4:1358
(anonymous) @ import.min.js?v=7.9&ver=5.2.4:1246
dispatch @ load-scripts.php?c=0&load[]=jquery-core,utils&ver=5.2.4:3
r.handle @ load-scripts.php?c=0&load[]=jquery-core,utils&ver=5.2.4:3
import.min.js?v=7.9&ver=5.2.4:1384 Uncaught Error: error
at Object.error (import.min.js?v=7.9&ver=5.2.4:1384)
at i (load-scripts.php?c=0&load[]=jquery-core,utils&ver=5.2.4:2)
at Object.fireWith [as rejectWith] (load-scripts.php?c=0&load[]=jquery-core,utils&ver=5.2.4:2)
at x (load-scripts.php?c=0&load[]=jquery-core,utils&ver=5.2.4:4)
at XMLHttpRequest.c (load-scripts.php?c=0&load[]=jquery-core,utils&ver=5.2.4:4)
但是这将导致$url=$_SERVER['HTTP_HOST']; // www.abc.alpha.beta.xyz
$url=strtolower($url);
$rwww=str_replace("www.","",$url);
,期望的结果是abc.alpha.beta.xyz
。如何仅获得第一个子域,而忽略abc
(如果存在)?