XAMPP包含在PHP和AJAX中的路径

时间:2013-10-08 13:54:03

标签: php ajax xampp

在阅读了大量文章并尝试了很多代码后,我不能让我的本地主机包含一个php文件。并知道我甚至无法在javascript代码中指定路径,如

xmlhttp.open("GET","/DB/ajax/ajaxDeleteRow.php?q="+commentId,true);

我想要包含文件:drawTableSqlString.php,它与我的文件位于同一文件夹中:CommentTableAndDeleteAjax.php。它们位于以下文件夹中:C:\ xampp \ htdocs \ DB \ ajax

到目前为止我尝试了什么:

1。 echo get_include_path();我显示了:。; C:\ xampp \ php \ PEAR 然后我尝试将我的文件复制到该文件夹​​中 - >没用。

  1. echo dirname(drawTableSqlString.php);

  2. 我收到了一个错误: 注意:使用未定义的常量drawTableSqlString - 在第36行的C:\ xampp \ htdocs \ DB \ ajax \ CommentTableAndDeleteAjax.php中假定为'drawTableSqlString'

    3。 将php.ini中的路径从“include_path =”.; C:\ xampp \ htdocs“”更改为include_path =“。; C:\ xampp \ php \ PEAR”

    我试过了:

    include ('\DB\ajax\drawTableSqlString.php');
    include ('DB\ajax\drawTableSqlString.php');
    

    给出了一个错误,如下所示:

      

    警告:include(\ DB \ ajax \ drawTableSqlString.php):无法打开   stream:没有这样的文件或目录   第33行的C:\ xampp \ htdocs \ DB \ ajax \ CommentTableAndDeleteAjax.php

         

    警告:include():打开'\ DB \ ajax \ drawTableSqlString.php'失败   包含(include_path ='。; C:\ xampp \ htdocs')in   第33行的C:\ xampp \ htdocs \ DB \ ajax \ CommentTableAndDeleteAjax.php

    根据其他论坛条目,我也尝试了以下所有代码,但没有任何效果:

    //************************** include DB connection INFOS
    //$xajax_dir = 'C:\\xampp\\htdocs\\DB\\ajax'; 
    //include( $xajax_dir . DIRECTORY_SEPARATOR . 'drawTableSqlString.php' );   
    
    //include('./localhost/DB/ajax/CommentTableAndDeleteAjax.php' );   
    //include('localhost/DB/ajax/CommentTableAndDeleteAjax.php' );   
    //include('./DB/ajax/CommentTableAndDeleteAjax.php' );   
    //include('DB/ajax/CommentTableAndDeleteAjax.php' );   
    //include('C:/xampp/htdocs/localhost/DB/ajax/drawTableSqlString.php' );   
    //include_path = ('.;C:\xampp\php\PEAR','C:\xampp\htdocs\DB\ajax\drawTableSqlString.php');
    //include('127.0.0.1/DB/ajax/CommentTableAndDeleteAjax.php' ); 
    //include('C:\xampp\htdocs\DB\ajax\drawTableSqlString.php');
    //FROM http://stackoverflow.com/questions/17003614/including-files-from-include-path-not-working-as-expected
    //include_once ('/DB/ajax/drawTableSqlString');
     //include_once("C:/xampp/htdocs/DB/ajax/drawTableSqlString.php");
    // include __DIR__ . 'drawTableSqlString.php';
    // include '../drawTableSqlString.php';
    //include('http://127.0.0.1/DB/ajax/CommentTableAndDeleteAjax.php' ); 
    //$xajax_dir = 'C:\\xampp\\htdocs\\DB\\ajax'; 
    //include( $xajax_dir . DIRECTORY_SEPARATOR . 'drawTableSqlString.php' );   
    //include ('drawTableSqlString.php');
    //include_path=".;c:\php\includes"
    
    //http://www.php.net/manual/en/ini.core.php#ini.include-path
    //set_include_path(".;c:\xampp\htdocs\DB\ajax");
    
    //include ('drawTableSqlString.php');
    
    //echo get_include_path();
    

    任何帮助都会非常准确。

    编辑:

    由于我更改了php.ini的某些部分,因此在查看XAMPP时会出现错误:

      

    致命错误:指令'register_globals'不再可用   PHP

0 个答案:

没有答案