0

Is there any way we can call odbc_connect() without any parameters in php? By this i mean is there any way in php.ini to have such settings to set username,password and dsn in advance or any other way? Thanks.

4

1 回答 1

0

您可以创建自己的配置文件(例如 config.php)和另一个文件来保存一些在您的网站中使用的标准功能。

然后,您创建自己的函数(例如 aragorn_connect()),该函数从配置文件中读取并正常运行 odbc_connect()。因此,下次您需要使用 db 时,您只需调用 aragorn_connect() 即可。

或者

您可以使用在线可用的框架之一(cakePHP、Yii、cogeigniter 等)。

于 2012-04-24T06:39:04.430 回答