invoke(_FANWE_SAAS_LICENSE_AUTH_URL, array('domain'=>$domain)); if (empty($ret) || $ret['errcode'] != 0) { _fsauth_failAndExit('The domain is not licensed, Online license error: '.$ret['errmsg']); return ''; } // 保存授权文件(保存到SAAS服务端返回的授权域名目录下) $retdata = $ret['data']; $licenseDomain = $retdata['domain']; $licenseContent = $retdata['license']; if (strpos($licenseDomain, '*.') === 0) { // 替换掉域名中的星号 $licenseDomain = str_replace('*', '^', $licenseDomain); // 替换掉星号 } $licpath = _FANWE_SAAS_LICENSE_ROOT_DIR.$licenseDomain.'/'; $licfile = $licpath.'license'; if (!file_exists($licpath)) { mkdir($licpath, 0777, true); } file_put_contents($licfile, $licenseContent); // 返回 return $licfile; } function _fsauth_strEndWith($haystack, $needle) { $length = strlen($needle); if ($length == 0) { return true; } return (substr($haystack, -$length) === $needle); } // 进行授权认证 // 1. 获取授权文件路径,授权文件不存在时,根据情况到SAAS基础平台获取 $licfile = _fsauth_getLicenseFile(); if ($licfile == '' || !file_exists($licfile)) { _fsauth_failAndExit('The domain is not licensed!'); return; } // 2. 进行授权判断 define("LICENSE_PATH", dirname($licfile).'/'); $fanwe = new Fanwe; $rs = $fanwe->init();