how to set path for specific file in php

放肆的年华 提交于 2019-12-25 12:38:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!