【问题标题】:php GLOBALS session filephp GLOBALS 会话文件
【发布时间】:2014-01-24 05:57:07
【问题描述】:

我正在开发会员系统,但遇到了瓶颈,通常我只会在这里发布问题,但我有一个错误,我无法解决,并且这个错误已经持续了一个多小时。

我得到的错误是:

*解析错误:语法错误,第 10 行 /home/ob219/public_html/membership/core/init.php 中的意外 ','*

我只是看不到代码中的错误,会用第二双眼睛查看代码。

代码

    <?php
session_start();

$GLOBALS['config'] = array(
    'mysql' => array(),
        'host' => '#####',
        'username' => '###',
        'password' => 's####',
        'db' => '####'
    ),
    'remeber' => array(
        'cookie_name' => 'hash',
        'cookie_expiry' => 604800
    ),
    'session' => array(
        'session_name' => 'user'
    )
);

spl_autoload_register(function($class) {
    require_once 'classes/' . $class . 'php';
});

require_once 'functions/sanitize.php';

【问题讨论】:

    标签: php mysql compiler-errors config


    【解决方案1】:

    'mysql' =&gt; array(), 应该是'mysql' =&gt; array(

    【讨论】:

      【解决方案2】:
      $GLOBALS['config'] = array(
         'mysql' => array(
              'host' => '#####',
              'username' => '###',
              'password' => 's####',
              'db' => '####'
          ),
          'remeber' => array(
              'cookie_name' => 'hash',
              'cookie_expiry' => 604800
          ),
          'session' => array(
              'session_name' => 'user'
          )
      );
      

      【讨论】:

        【解决方案3】:
        $GLOBALS['config'] = array(
            'mysql' => array(), <===== syntax error here. you don't want the close) and comma
        

        【讨论】:

          猜你喜欢
          • 2010-10-13
          • 2013-01-21
          • 2012-12-23
          • 1970-01-01
          • 2011-07-21
          • 1970-01-01
          • 2012-05-29
          • 2015-02-07
          • 1970-01-01
          相关资源
          最近更新 更多