数据库链接错误 : Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

87.       * @param dbConfig  数据库配置
88.       */
89.      public function __construct($dbConfig)
90.      {
91.          $linkfunction = ( TRUE == $dbConfig['persistent'] ) ? 'mysql_pconnect' 'mysql_connect';
92.          @$this->conn $linkfunction($dbConfig['host'].":".$dbConfig['port'], $dbConfig['login'], $dbConfig['password']) or spError("数据库链接错误 : " mysql_error()); 
93.          mysql_select_db($dbConfig['database'], $this->conn) or spError("无法找到数据库,请确认数据库名称正确!");
94.          $this->exec("SET NAMES UTF8");
95.      }
96.      /**
97.       对特殊字符进行过滤
148.          }
149.      }
150.      if(FALSE != $has_define){
151.          $argString '';$comma ''
152.          if(null != $args)for ($i 0$i count($args); $i ++) { $argString .= $comma "\$args[$i]"$comma ', '; } 
153.          eval("\$GLOBALS['G_SP']['inst_class'][\$class_name]= new \$class_name($argString);"); 
154.          return $GLOBALS['G_SP']["inst_class"][$class_name];
155.      }
156.      spError($class_name."类定义不存在,请检查。");
157.  }
158. 
47.      {
48.          if( null == $this->tbl_name )$this->tbl_name $GLOBALS['G_SP']['db']['prefix'] . $this->table;
49.          if( '' == $GLOBALS['G_SP']['db_driver_path'] ){
50.              $GLOBALS['G_SP']['db_driver_path'] = $GLOBALS['G_SP']['sp_drivers_path'].'/'.$GLOBALS['G_SP']['db']['driver'].'.php';
51.          }
52.          $this->_db spClass('db_'.$GLOBALS['G_SP']['db']['driver'], array(0=>$GLOBALS['G_SP']['db']), $GLOBALS['G_SP']['db_driver_path']);
53.      }
54.      public function getAll($sql)
55.      {
56.          $res $this->query($sql);
57.          if ($res !== false)
148.          }
149.      }
150.      if(FALSE != $has_define){
151.          $argString '';$comma ''
152.          if(null != $args)for ($i 0$i count($args); $i ++) { $argString .= $comma "\$args[$i]"$comma ', '; } 
153.          eval("\$GLOBALS['G_SP']['inst_class'][\$class_name]= new \$class_name($argString);"); 
154.          return $GLOBALS['G_SP']["inst_class"][$class_name];
155.      }
156.      spError($class_name."类定义不存在,请检查。");
157.  }
158. 
1.  <?php
2.  define "HOST_URL"'http://'.$_SERVER ['SERVER_NAME'] );
3. 
4.  $row=spClass('site_config')->findAll();//基本设置参数
5.  foreach($row as $k=>$v){
6.      switch ($v['id']){
7.          case 903://链接
8.              $config[$v['id']]='http://'.str_replace(array('http://','https://'), ''trim(trim($v['value']),'/'));
9.              break;
1.  <?php
2.  class product extends spController
3.  {
4.      function __construct(){ // 公用
5.          parent::__construct(); // 这是必须的    
6.          include('common.php');
7.      }
8. 
9.      function index(){
10.          $id intval($_GET['id']);
11.          $boolen true;
148.          }
149.      }
150.      if(FALSE != $has_define){
151.          $argString '';$comma ''
152.          if(null != $args)for ($i 0$i count($args); $i ++) { $argString .= $comma "\$args[$i]"$comma ', '; } 
153.          eval("\$GLOBALS['G_SP']['inst_class'][\$class_name]= new \$class_name($argString);"); 
154.          return $GLOBALS['G_SP']["inst_class"][$class_name];
155.      }
156.      spError($class_name."类定义不存在,请检查。");
157.  }
158. 
9.  function spRun(){
10.      GLOBAL $__controller$__action;
11.      // 对路由进行自动执行相关操作
12.      spLaunch("router_prefilter");
13.      // 对将要访问的控制器类进行实例化
14.      $handle_controller spClass($__controllernull$GLOBALS['G_SP']["controller_path"].'/'.$__controller.".php");
15.      // 调用控制器出错将调用路由错误处理函数
16.      if(!is_object($handle_controller) || !method_exists($handle_controller$__action)){
17.          $spController = new spController();
18.          $spController->error('404 Not Found',spUrl("main","index"));exit;
19.          
12. 
13.  // 载入SpeedPHP框架
14.  require(SP_PATH."/SpeedPHP.php");
15.  require("functions_index.php");
16.  require_once('360_safe3.php');
17.  spRun(); // SpeedPHP 3新特性