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行还是什么的无效代码,怎么删除或不用删除怎么修改
展开
 我来答
dispose
推荐于2016-11-03 · TA获得超过642个赞
知道小有建树答主
回答量:458
采纳率:0%
帮助的人:493万
展开全部

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)
睡睡睡觉觉觉go
2016-01-29 · TA获得超过2722个赞
知道大有可为答主
回答量:8933
采纳率:58%
帮助的人:809万
展开全部
重新覆盖原有程序代码,不要用记事本修改
来自:求助得到的回答
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式