【发布时间】:2016-04-09 18:41:40
【问题描述】:
伙计们!
这是我第一次在 PHP CLI 中使用大型脚本,在我的脚本中使用 sqlsrv_connect 函数时遇到了“未找到”错误。
在浏览器中运行脚本没问题,连接一切正常,查询尽可能好;但是在 CLI 中,我的朋友,它会显示
Fatal error: Call to undefined function sqlsrv_connect()
会是什么,黑魔法还是新手开发者?
这就是我使用函数的方式:
$_dbip = '127.0.0.1';
$_dbnome = $nome_bd;
$_dbuid = 'sa';
$_dbpwd = 'very_strong_secret_pwd';
$conn = sqlsrv_connect($_dbip, array('Database' => $_dbnome, 'UID' => $_dbuid, 'PWD' => $_dbpwd)) or die( print_r( sqlsrv_errors(), true));
提前致谢!
【问题讨论】:
-
你能发布你的 PHP 代码吗?可以帮助其他人确定问题所在。
-
刚刚编辑了问题,添加了代码。不过,这很简单。
标签: php sql-server sqlsrv