谢谢大神帮忙看看错在那里
错误提示代码:
( ! ) Fatal error: Cannot declare class logincheckentry, because the name is already in use in'd:/web/system/autofile/logincheckentry.php on line 15<?php
$dir = 'd:/web/system/autofile/'; // 这个目录下只有一个文件 logincheckentry.php
if ($dh = opendir($dir))
{
while (($autofile = readdir($dh)) !== false)
{
//略过linux目录的名字为'.'和‘..'的文件
if($autofile != '.' && $autofile != '..')
{ //strrchr() 函数查找字符串在另一个字符串中最后一次出现的位置,并返回从该位置到字符串结尾的所有字符
$fix = substr(strrchr($autofile, '.'), 1);
if($fix == 'php')
{
require_once $dir.$autofile;
} //加载文件,把文件写入编译HX110里
}
}
closedir($dh);
}
加载的文件logincheckentry.phpclass logincheckentry{
function __construct(){ $this->index();
}
function index()
{
echo "加载成功"; }
}
错误提示代码:
( ! ) Fatal error: Cannot declare class logincheckentry, because the name is already in use in'd:/web/system/autofile/logincheckentry.php on line 15<?php
$dir = 'd:/web/system/autofile/'; // 这个目录下只有一个文件 logincheckentry.php
if ($dh = opendir($dir))
{
while (($autofile = readdir($dh)) !== false)
{
//略过linux目录的名字为'.'和‘..'的文件
if($autofile != '.' && $autofile != '..')
{ //strrchr() 函数查找字符串在另一个字符串中最后一次出现的位置,并返回从该位置到字符串结尾的所有字符
$fix = substr(strrchr($autofile, '.'), 1);
if($fix == 'php')
{
require_once $dir.$autofile;
} //加载文件,把文件写入编译HX110里
}
}
closedir($dh);
}
加载的文件logincheckentry.phpclass logincheckentry{
function __construct(){ $this->index();
}
function index()
{
echo "加载成功"; }
}
是说 类 logincheckentry 的定义已经存在了
同名类不能多次定义,这是基本规则