$strXML = __DIR__ . "/../xml/file.xml"; $xmlFile = simplexml_load_file($strXML); $strPath = fullPathFunction($xmlFile); //Desired function
你可以用 realpath 功能:
realpath
$strXML = "../xml/file.xml"; $xmlFile = simplexml_load_file($strXML); $strPath = realpath($strXML);