当我在类中实现接口并执行代码时,出现以下错误:
Fatal error: Interface 'IConn' not found in C:\xampp\htdocs\aulaPHP\SoNet\php_oo\OO_advanced\code_03_class_conn\Conn.php on line 3
这个问题是所有文件一起正确放置,但是在“Conn”文件中找不到接口。 这是代码:
<?php
class Conn implements IConn
{
private $dsn;
private $user;
private $pass;
public function __construct($dsn, $user, $pass)
{
$this->dsn = $dsn;
$this->user = $user;
$this->pass = $pass;
}
public function connect()
{
return new \PDO($this->dsn,$this->user,$this->pass);
}
}
?>