如何在php中设置特定文件的路径 [英] how to set path for specific file in php

查看:131
本文介绍了如何在php中设置特定文件的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经完成了每件事,但是我无法进入文件夹.我的文件路径:C:\ xampp \ htdocs \ Project \ p \ new project \ admin \ index.html,但失败.我将条件放在if部分中,以便如果条件为true,则应从该路径打开文件.我不知道为什么我失败了.这是我的代码:

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>

推荐答案

您需要正确设置包含路径.取消注释该行,并添加路径分隔符,并包含目录而不是文件.请参见此处.

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"));

这篇关于如何在php中设置特定文件的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆