它给了我这个错误
Warning: PDO::__construct() [<a href='pdo.--construct'>pdo.--construct</a>]: [2002] No connection could be made because the target machine actively refused it. (trying to connect via tcp://xxxx.xxxx.xxx:3306)
但有时还可以,没问题
这是我的代码
class Data
{
private $pdo;
public function __construct()
{
try {
$this->pdo = new PDO(
'mysql:host=xxxx.xxx.xxx;
dbname=xxxx;
charset=utf8',
'xxx',
'xxx'
);
}
catch(PDOException $e){
echo $e->getMessage();
}
}
public function Test($session_id)
{
//do something here
}
public function Test1($from, $to)
{
//do something here
}
我该如何解决这个问题?感到困惑,因为有时它有效,有时无效。
任何帮助或建议都会有很大帮助,谢谢!