pdf文件地址
This commit is contained in:
@@ -395,9 +395,16 @@ class UsedCarController extends BaseController
|
||||
if (!file_exists($publicFile)) {
|
||||
copy($filePath, $publicFile);
|
||||
}
|
||||
|
||||
// 从连接中获取协议(最可靠)
|
||||
$connection = $request->connection;
|
||||
$protocol = 'https';
|
||||
if ($connection && property_exists($connection, 'transport')) {
|
||||
$protocol = $connection->transport === 'ssl' ? 'https' : 'http';
|
||||
}
|
||||
|
||||
// 返回访问地址
|
||||
$baseUrl = 'http://' . request()->header('host');
|
||||
$baseUrl = $protocol.'://' . request()->header('host');
|
||||
$url = $baseUrl . '/pdf/' . $raw['pdf_src'];
|
||||
|
||||
return $this->success([
|
||||
|
||||
Reference in New Issue
Block a user