php - Ubuntu Server 14.04 LAMP更改php目录

标签 php linux ubuntu

我安装了 ubuntu 服务器 14.04,我面临的问题是每当我设置

require_once '/connection.php';

我遇到的问题是没有这样的文件或目录。我可以使用

来解决这个问题
require_once '/var/www/html/connection.php';

或与

define('__ROOT__', dirname(dirname(__FILE__)));
require_once (__ROOT__ . '/connection.php');

有没有办法将/var/www/html/目录更改为/

如果我的英语不好,我很抱歉

最佳答案

尝试 require_once './connection.php'; 使用 ./ 您将获得当前目录

关于php - Ubuntu Server 14.04 LAMP更改php目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26518723/

相关文章:

php - 如果/否则结果不是预期的

php - 在数据库 PHP/MySQL 中查找类似的描述

php - git push php 和主机 key 验证失败

linux - 这个 linux 命令是做什么的 : "cd !!:1"

flutter - 如何在远程服务器上运行 dart http 服务器

linux - 无法在 Ubuntu 中使用 Cabal

php - 多次扩展 Laravel 验证器

c++ - 我怎样才能确定 dlopen 正常工作

linux - Ambari服务器无法启动

python - Emacs Python 自动补全