问题
i have done each and every thing but i cant get into the folder. my file path: C:\xampp\htdocs\Project\p\new project\admin\index.html but failed. i have place the condition in if portion so that if condtion is true, then should open up a file fron that path. i dont know why m getting failed. here is my code:
<html>
<body>
<?php
session_start();
if($_SESSION['SHALA']!=1)
{
echo" Authentication unsuccessful";
}
else if($_SESSION['SHALA']==1)
{
$_SESSION['SHALA']=1;
$con=mysql_connect("localhost","root","");
mysql_select_db("civil",$con);
$username=$_SESSION['u'];
$passid=$_SESSION['p'];
echo $username;
echo $passid;
if($username=="amirlatif")
{
echo "hello";
//include('C:\xampp\htdocs\new project\admin');
//ini_set("include_path", "/C:\xampp\htdocs\new project\admin\admin.html".ini_get("include_path"));
dirname('C:\xampp\htdocs\new project\admin\index.html');
}
else
{
//iss main user profile ka ok!!!
}
}
?>
</body>
</html>
回答1:
You need to set the include path properly. Uncomment the line and add a path separator and include the directory, not a file. See here.
ini_set("include_path", "C:\xampp\htdocs\new project\admin" . ":" .
ini_get("include_path"));
来源:https://stackoverflow.com/questions/21363891/how-to-set-path-for-specific-file-in-php