【发布时间】:2019-09-08 11:16:38
【问题描述】:
我有这个代码:
<?php
session_start();
if( isset( $_SESSION[ 'user' ] ) )
{
$pictures = glob( "http://localhost/wandelverhalen/cms/newPictures/*.*" );
echo count( $pictures );
echo "\n";
echo( $_SESSION[ 'user' ] );
}else{
echo('You are not logged on.');
}
?>
我在http://localhost/wandelverhalen/cms/newPictures 目录中有 50 个文件。但代码回显: 0 约翰内斯
这是调用 php 代码的 javascript:
$.ajax({
method: 'post',
url: url,
dataType: 'json',
success: function( response ){
var data = response;
console.log( data );
},
error: function( err ){
console.log( err.responseText );
}
});
我找到了类似问题的各种答案,但没有一个能解决我的问题。
非常感谢您的帮助。
【问题讨论】: