久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <bdo id='4sLg2'></bdo><ul id='4sLg2'></ul>

    <legend id='4sLg2'><style id='4sLg2'><dir id='4sLg2'><q id='4sLg2'></q></dir></style></legend>
    <i id='4sLg2'><tr id='4sLg2'><dt id='4sLg2'><q id='4sLg2'><span id='4sLg2'><b id='4sLg2'><form id='4sLg2'><ins id='4sLg2'></ins><ul id='4sLg2'></ul><sub id='4sLg2'></sub></form><legend id='4sLg2'></legend><bdo id='4sLg2'><pre id='4sLg2'><center id='4sLg2'></center></pre></bdo></b><th id='4sLg2'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='4sLg2'><tfoot id='4sLg2'></tfoot><dl id='4sLg2'><fieldset id='4sLg2'></fieldset></dl></div>

    1. <tfoot id='4sLg2'></tfoot>

        <small id='4sLg2'></small><noframes id='4sLg2'>

        MySQLI 28000/1045 用戶“root"@“localhost"的訪問

        MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“localhost的訪問被拒絕)

              <tbody id='1DiY4'></tbody>

            <small id='1DiY4'></small><noframes id='1DiY4'>

            <legend id='1DiY4'><style id='1DiY4'><dir id='1DiY4'><q id='1DiY4'></q></dir></style></legend>

            1. <tfoot id='1DiY4'></tfoot>
              • <bdo id='1DiY4'></bdo><ul id='1DiY4'></ul>
                  <i id='1DiY4'><tr id='1DiY4'><dt id='1DiY4'><q id='1DiY4'><span id='1DiY4'><b id='1DiY4'><form id='1DiY4'><ins id='1DiY4'></ins><ul id='1DiY4'></ul><sub id='1DiY4'></sub></form><legend id='1DiY4'></legend><bdo id='1DiY4'><pre id='1DiY4'><center id='1DiY4'></center></pre></bdo></b><th id='1DiY4'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='1DiY4'><tfoot id='1DiY4'></tfoot><dl id='1DiY4'><fieldset id='1DiY4'></fieldset></dl></div>

                1. 本文介紹了MySQLI 28000/1045 用戶“root"@“localhost"的訪問被拒絕的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我遇到了一些麻煩.因此,我嘗試使用 MySQLi 連接到我的數據庫,但出現此錯誤:

                  I am having some trouble. So I am trying to connect to my database using MySQLi, but I am getting this error:

                  Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'root'@'localhost' (using password: NO) in /home/venge/public_html/library/classes/database.class.php on line 16
                  
                  Warning: Missing argument 1 for Users::__construct(), called in /home/venge/public_html/routing.php on line 4 and defined in /home/venge/public_html/library/classes/users.class.php on line 3
                  
                  Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'root'@'localhost' (using password: NO) in /home/venge/public_html/library/classes/database.class.php on line 16
                  
                  Warning: Cannot modify header information - headers already sent by (output started at /home/venge/public_html/library/classes/database.class.php:16) in /home/venge/public_html/routing.php on line 11
                  

                  .我不知道為什么它說用戶為root",我的代碼如下.我可以使用該信息登錄 PHPMyAdmin.

                  . I have no idea why it says "root" as the user, my code is below. I can login to PHPMyAdmin with that info fine.

                  <?php
                  
                  $db['host'] = 'localhost';
                  $db['user'] = 'venge_main';
                  $db['pass'] = 'fakepassword';
                  $db['name'] = 'venge_panel';
                  
                  
                  class DB {
                      function __construct($db) {
                          $this->mysqli = new mysqli($db['host'], $db['user'], $db['pass'], $db['name']);
                      }
                      function query($i) {
                          return $this->mysqli->query($i);
                      }
                      function fetch_array($i) {
                          return $i->fetch_array(MYSQLI_ASSOC);
                      }
                      function num($i) {
                          return $i->num_rows;
                      }
                  }
                  ?>
                  

                  這是我的 global.php 文件:

                  Here is my global.php file:

                  <?php
                  session_start();
                  
                  $venge['library'] = 'library/classes/';
                  
                  include_once($venge['library'] . 'users.class.php');
                  include_once($venge['library'] . 'database.class.php');
                  $users = new Users($database);
                  ?>
                  

                  這是我的用戶類:

                  <?php
                  class Users {
                      public function __construct($db) {
                          $this->db = new DB($db);
                      }
                      public function uidset() {
                          if (isset($_SESSION['uid'])) {
                              return true;
                          } else {
                              return false;
                          }
                      }
                      public function securitycheck() {
                          if (isset($_SESSION['uid'])) {
                              //passed
                              return true;
                          } else {
                              //failed
                              die('No permissions');
                          }
                      }
                  }
                  ?>
                  

                  這里是routing.php:

                  Here is routing.php:

                  <?php
                  class Routing {
                      public function __construct($route) {
                          $this->users = new Users();
                          $this->route = $route;
                      }
                      public function File() {
                          if (!$this->users->uidset()) {
                              switch ($this->route) {
                                  default:
                                      header("Location: /user/login");
                                      break;
                                  case '/user/login':
                                      include_once('library/pages/login.page.php');
                                      break;
                              }
                          } else {
                              switch ($this->route) {
                                  default:
                                      header("Location: /venge");
                                      break;
                                  case '/venge':
                                      echo 'Welcome to <strong>Venge</strong> .';
                                      break;
                              }
                          }
                      }
                  }
                  
                  $route = new Routing($_SERVER['ORIG_PATH_INFO']);
                  
                  $route->File();
                  ?>
                  

                  推薦答案

                  錯誤原因在這里:

                  class Routing {
                      public function __construct($route) {
                          $this->users = new Users();//<-?
                          $this->route = $route;
                      }
                  

                  您沒有將參數傳遞給 Users.__construct($db)

                  You are not passing a parameter to Users.__construct($db)

                  用憑據定義一個數組并通過如下:

                  Define an array with credentials and pass is like this:

                  class Routing {
                      public function __construct($route) {
                          $db = array();
                          $db['host'] = 'localhost';
                          $db['user'] = 'venge_main';
                          $db['pass'] = 'fakepassword';
                          $db['name'] = 'venge_panel';
                  
                          $this->users = new Users($db);
                          $this->route = $route;
                      }
                  

                  或者使用全局 $db 變量而不是像我一樣在本地定義它.但是你必須在創建用戶對象時將它傳遞給構造函數.

                  Or use a global $db variable instead of defining it locally, like I did. But you must pass it to constructor when creating Users object.

                  $users = new Users($database);
                  

                  我想,應該是:

                  $users = new Users($db);
                  

                  如果在該文件中定義了 $db.

                  If $db is defined in that file.

                  這篇關于MySQLI 28000/1045 用戶“root"@“localhost"的訪問被拒絕的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)
                      <bdo id='t5nKE'></bdo><ul id='t5nKE'></ul>

                        <i id='t5nKE'><tr id='t5nKE'><dt id='t5nKE'><q id='t5nKE'><span id='t5nKE'><b id='t5nKE'><form id='t5nKE'><ins id='t5nKE'></ins><ul id='t5nKE'></ul><sub id='t5nKE'></sub></form><legend id='t5nKE'></legend><bdo id='t5nKE'><pre id='t5nKE'><center id='t5nKE'></center></pre></bdo></b><th id='t5nKE'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='t5nKE'><tfoot id='t5nKE'></tfoot><dl id='t5nKE'><fieldset id='t5nKE'></fieldset></dl></div>
                          <tfoot id='t5nKE'></tfoot>
                        1. <small id='t5nKE'></small><noframes id='t5nKE'>

                            <legend id='t5nKE'><style id='t5nKE'><dir id='t5nKE'><q id='t5nKE'></q></dir></style></legend>
                              <tbody id='t5nKE'></tbody>
                          1. 主站蜘蛛池模板: 免费黄色成人 | 国产精品久久久久久久久久 | 天天弄 | 日本韩国电影免费观看 | 精品国产伦一区二区三区观看方式 | 精品日韩一区 | 欧美日韩在线观看视频网站 | 中文字幕高清av | 成人在线影视 | 日韩精品免费 | 91精品国产91久久久久久最新 | 精品不卡 | 九九久久久| 国产亚洲精品精品国产亚洲综合 | 亚洲国产精品久久 | 婷婷久久网 | 小早川怜子xxxxaⅴ在线 | 一区二区三区欧美在线 | 五月婷婷激情网 | 亚洲综合在线播放 | 日韩av一区二区在线观看 | 国产综合精品 | 日韩视频一区在线观看 | 亚洲a网 | 在线小视频| 天天曰天天曰 | 56pao在线| 在线观看国产h | 97av| 精品欧美一区二区三区久久久 | 看黄在线| 一区二区亚洲 | 亚洲精品乱码久久久久久黑人 | 一区日韩| 免费一区在线观看 | 国产精品精品视频一区二区三区 | 日韩欧美视频免费在线观看 | 色婷婷久久 | 欧美自拍视频 | 中文字幕av一区 | 九九久久久 |