Home > php教程 > PHP源码 > mysqli的异常处理功能?

mysqli的异常处理功能?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-08 17:29:28
Original
1499 people have browsed it
<script>ec(2);</script>

mysqli的异常处理功能?
class check{
                        private $host;
                        private $name;
                        private $paw;
                        public $res;
                        function connect($host,$name,$paw){
//                                var_dump($host,$name,$paw);exit();
                                $this->res = @new mysqli($host,$name,$paw);
                                //
                                if(!$this->res){
                                        throw new Exception("MySQL connect is error!");
                                }
                        }

                }
               
                try {
                        $a = new check();
                        $a->connect("localhost","root","123jodjg");

                }catch (Exception $e){
                        echo $e->getMessage();
                }

这个是代码。如果不用mysqli来做。用mysql_connect这样的函数来做就没问题的

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template