我正在开发一个没有DNS RR的网站。
我已经修改了Windows主机文件,以便可以使用它。
当我点击链接时,文件没有被下载,这正常吗?
<a href="http://mathieu-icstar.dev.univ-amu.fr/system/files/2019-10/SUFLE-emplois_du_temps_240919.pdf" type="application/pdf; length=919827" target="_blank">SUFLE-emplois_du_temps_240919.pdf</a>在新窗口上复制href时可以正常工作。
发布于 2019-10-02 22:04:58
如果你的make网站没有使用任何框架,那么只需为你的公共路径使用一个变量,而不是给出资源或链接的相对路径。
constant.php
<?php
define("PUBLIC_PATH", strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,5))=='https://'?'https://':'http://'.$_SERVER['SERVER_NAME'].str_replace($_SERVER['DOCUMENT_ROOT'], '', str_replace('\\', '/', dirname(__DIR__))).'/');
?>index.php
<?php
include "constant.php";
?>
<a href="<?= PUBLIC_PATH ?>system/files/2019-10/SUFLE-emplois_du_temps_240919.pdf" type="application/pdf; length=919827" target="_blank">SUFLE-emplois_du_temps_240919.pdf</a>https://stackoverflow.com/questions/58202631
复制相似问题