我想从其他php文件中调用函数
这是我的代码|但它不适合我,
配置文件
<?php
class config {
public static function get($param) {
$config = array(
// language selection,
'language' => 'english',
// allow users to sign up (true/false)
'allow_signup' => true,
);
/**
*
* End of configuration options
*
*/
}
}
其他文件我想在此文件中调用一个函数,如果“allow-signup”为true,则应显示一个注册按钮
<?php
require_once "configuration.php";
$app = new gator();
?>
<?php if (config::get('allow_signup')):?>
<input class="nice radius secondary button" style="float:left;" type="Submit" value="Sign up">
<?php endif;?>
?>
答案 0 :(得分:1)
你没有在你的get config中返回一个值
<?php
class config {
$config = array(
'language' => 'english',
'allow_signup' => true,
);
public static function get($param) {
return $config[$param];
}
}