问答详情
源自:1-3 PDO连接数据库

ubuntu下的uri:fille//路径要如何写?

用的ubuntu,不知道如何写如下的路径

$dsn='uri:file///opt/lampp/htdocs/dsn.txt';

Warning: PDO::__construct(file///opt/lampp/htdocs/dsn.txt): failed to open stream: No such file or directory in /opt/lampp/htdocs/test.php on line 7
invalid data source URI



提问者:慕盖茨9705228 2015-09-20 19:39

个回答

  • kopite
    2016-08-14 12:21:17

    $dsn = 'uri:file://D:\Users\...\dpo_sql\dsn.txt';

  • 慕盖茨9705228
    2015-10-04 08:54:32

    在网上查到写成如下:  

      $dsn='uri:file:////opt/lampp/htdocs/dsn.txt';

    只是写成这样,会出现如下

    could not find driver

    呵呵