[英]My spl_autoload_register() function is not working for cpanel but working fine in localhost
My spl_autoload_register()
function is not working for cpanel but working fine in localhost.我的spl_autoload_register()
function 不适用于 cpanel,但在 localhost 中工作正常。
Here is the code for input class in input.php
file:-这是input.php
文件中输入 class 的代码:-
class Input {
public static function exists($type = 'post') {
switch($type) {
case 'post':
return return $_POST[$item];
break;
default:
return false;
break;
}
}}
and through this init.php
file below I am trying to access my input.php
file.通过下面的这个init.php
文件,我试图访问我的input.php
文件。
spl_autoload_register(function($class) {
require_once $class . '.php';
});
and now I am trying to get access the init.php
file in my form.php
file and I am unable to view the page and it is showing me the blank screen while uploading these files in cpanel but in my local host it is ok.现在我正在尝试访问我的表单中的init.php
文件form.php
文件,我无法查看该页面,它在 cpanel 中上传这些文件时显示空白屏幕,但在我的本地主机中它没问题。
require_once 'init.php';
if(Input::exists()) {
<form action="" method="post">
<label for='name'>name</label>
<input type="text" name="name" id="name">
<input type="submit" value="Login">
</form>
}else{
echo "no form";
}
The php spl_autoload_register() function usually have conflict on cpanel, Its is best you require all classes manually in the init file. php spl_autoload_register() function 通常在 cpanel 上有冲突,最好在 init 文件中手动要求所有类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.