注意,在我的store.php中,我有<?php include_once ("js.html"); ?>
我的目录地图&amp;文件路径。
public
|_css
|_img
|_include
| |_ajax
| | |_username.php
| |_config.php
| |_js.html
|_items
|_js
|_slides
|_store.php
这是我在js.html中的代码
<script>
function ajax_username_check()
{
var check_this=$("#username").val();
$.post("include/ajax/username.php", {username : check_this}, function(email) {
//code here
})
}
</script>
这是我在username.php中的代码
<?php
require_once('../include/config.php');
$username = $_POST['username'];
$user = new user($pdo);
if(!$username == "")
{
$ok = $user->checkUsername($username);
if($ok == true)
{
echo '1';
}
else
{
echo '0';
}
}
?>
我似乎无法做到这一点
require_once('../include/config.php');
我已尝试../config.php
,../include/config.php
,include/config.php
我的文件是这样的:
public
|_css
|_img
|_include
| |_ajax
| |
| |_config.php
| |_js.html
|_username.php
|_items
|_js
|_slides
|_store.php
js.html
<script>
function ajax_username_check()
{
var check_this=$("#username").val();
$.post("username.php", {username : check_this}, function(email) {
//code here
})
}
</script>
username.php
<?php
require_once('include/config.php');
$username = $_POST['username'];
$user = new user($pdo);
if(!$username == "")
{
$ok = $user->checkUsername($username);
if($ok == true)
{
echo '1';
}
else
{
echo '0';
}
}
?>
在重组我的文件夹时,我一直坚持这一点,我不知道这是不是一个简单的错误。任何帮助将不胜感激。谢谢!
答案 0 :(得分:0)
我想这就行了,我想:
require_once(dirname(__FILE__) . '/../config.php');