PHP 中的符号链接无效

Symlink in PHP not working

我在 Linux 环境中。我们有一个有 8 种语言的 CMS,图像是英文的物理文件:/store/products/image-car.png。我们正在尝试使用符号链接翻译所有这些文件,因此我们知道我们可以节省磁盘 space 并且当用户将导航器链接到 /store/products/imagen-coche.png(西班牙语)时,它将显示上面的文件。

symlink("/store/products/image-car.png" , "/store/products/imagen-coche.png");

但是它不工作,它抛出找不到文件。一定要绝对路径吗?

创建符号链接的最佳方式是使用绝对路径。但是你可以使用相对路径,但是符号链接路径应该是相对于原始文件的。如果符号链接打开,还要检查网络服务器。