config.php设置完后只有一个问题
<?php/***Copyright(C)2008-2012FluxBB*basedoncodebyRickardAnderssoncopyright(C)2002-20...
<?php
/**
* Copyright (C) 2008-2012 FluxBB
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
*/
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
exit;
/**
* Class flux_addon_manager
*
* This class is responsible for loading the addons and storing their hook listeners.
*/
class flux_addon_manager
{
var $hooks = array();
var $loaded = false;
function load()
{
$this->loaded = true;
foreach (glob(PUN_ROOT.'addons/*.php') as $addon_file)
{
$addon_name = 'addon_'.basename($addon_file, '.php');
include $addon_file;
$addon = new $addon_name;
$addon->register($this);
}
}
function bind($hook, $callback)
{
if (!isset($this->hooks[$hook]))
$this->hooks[$hook] = array();
if (is_callable($callback))
$this->hooks[$hook][] = $callback;
}
function hook($name)
{
if (!$this->loaded)
$this->load();
$callbacks = isset($this->hooks[$name]) ? $this->hooks[$name] : array();
// Execute every registered callback for this hook
foreach ($callbacks as $callback)
{
list($addon, $method) = $callback;
$addon->$method();
}
}
}
/**
* Class flux_addon
*
* This class can be extended to provide addon functionality.
* Subclasses should implement the register method which will be called so that they have a chance to register possible
* listeners for all hooks.
*/
class flux_addon
{
function register($manager)
{ }
}
Warning: Invalid argument supplied for foreach() in /users/jixie824/www/include/addons.php on line 29
帮我找到29行还是什么的无效代码,怎么删除或不用删除怎么修改 展开
/**
* Copyright (C) 2008-2012 FluxBB
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
*/
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
exit;
/**
* Class flux_addon_manager
*
* This class is responsible for loading the addons and storing their hook listeners.
*/
class flux_addon_manager
{
var $hooks = array();
var $loaded = false;
function load()
{
$this->loaded = true;
foreach (glob(PUN_ROOT.'addons/*.php') as $addon_file)
{
$addon_name = 'addon_'.basename($addon_file, '.php');
include $addon_file;
$addon = new $addon_name;
$addon->register($this);
}
}
function bind($hook, $callback)
{
if (!isset($this->hooks[$hook]))
$this->hooks[$hook] = array();
if (is_callable($callback))
$this->hooks[$hook][] = $callback;
}
function hook($name)
{
if (!$this->loaded)
$this->load();
$callbacks = isset($this->hooks[$name]) ? $this->hooks[$name] : array();
// Execute every registered callback for this hook
foreach ($callbacks as $callback)
{
list($addon, $method) = $callback;
$addon->$method();
}
}
}
/**
* Class flux_addon
*
* This class can be extended to provide addon functionality.
* Subclasses should implement the register method which will be called so that they have a chance to register possible
* listeners for all hooks.
*/
class flux_addon
{
function register($manager)
{ }
}
Warning: Invalid argument supplied for foreach() in /users/jixie824/www/include/addons.php on line 29
帮我找到29行还是什么的无效代码,怎么删除或不用删除怎么修改 展开
展开全部
29行应该是:foreach (glob(PUN_ROOT.'addons/*.php') as $addon_file)
目测:glob(PUN_ROOT.'addons/*.php') 返回了false,而不是数组。
可以先加一步判断:
$files = glob(PUN_ROOT.'addons/*.php');
if(is_array($files)){
foreach ($files as $addon_file)
{
$addon_name = 'addon_'.basename($addon_file, '.php');
include $addon_file;
$addon = new $addon_name;
$addon->register($this);
}
}
更多追问追答
追问
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting function (T_FUNCTION) in /users/jixie824/www/include/addons.php on line 75
本来可以登录或者其他操作的,现在一改全是空白+上面的错误代码
追答
你修改错了,肯定丢了一个反花括号 “}”
你要实在不会改,就换一个改法。
把
foreach (glob(PUN_ROOT.'addons/*.php') as $addon_file)
改为
foreach ((array)glob(PUN_ROOT.'addons/*.php') as $addon_file)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询