我收到php

时间:2017-05-09 14:45:29

标签: php

我在页面上收到此错误:警告:require(/FJ5/Connections/Connections.php):无法打开流:/var/customers/webs/ni1101438_1/Register.php中没有此类文件或目录第2行致命错误:require():在/ var / customers中打开所需的'/FJ5/Connections/Connections.php'(include_path ='。:/ usr / share / php /:/ usr / share / php5 /')失败第2行/webs/ni1101438_1/Register.php

这是我在文件中使用的代码: Register.php

<?php
require('/FJ5/Connections/Connections.php');
?>
<?php 

if(isset($_POST['Register'])) 

   session_start();
   $FName = $_POST['First_Name'];
   $LName = $_POST['Last_Name'];
   $Email = $_POST['Email'];
   $PW = $_POST['Password'];

   $sql = $con->query("INSERT INTO User (Fname, Lname, Email, 
   Password)Values('{$FName}', '{$LName}', '{$Email}', '{$PW}')")





?>

Connections.php

<?php
$con = mysqli_connect("localhost","ni1101438_1sql1","PW","ni1101438_1sql1");

?>

这是我的文件结构: File structure

我是php的新手,所以如果答案很简单,请不要责怪我。

1 个答案:

答案 0 :(得分:0)

/FJ5/Connections/Connections.php开始查找服务器的根目录,其中/ usr,/ home和/ etc所在。如果要开始查看Web根目录,请使用

require($_SERVER['DOCUMENT_ROOT'].'/FJ5/Connections/Connections.php');

如果您希望它与您正在运行的文件位于同一目录中,请在目录的开头添加句点:

require('./FJ5/Connections/Connections.php');