1

可能吗?如果是这样,如何?

我知道 php 和 MySQL 与 Apache 一起运行。

但是,如何使用 Yaws 脚本访问 MySQL 数据库?

4

1 回答 1

3

是的,有可能,这里有一些示例代码:

<erl> 

out(A) -> 
    application:start(odbc), 
    ConnString = 
        "Driver={MySQL ODBC 5.1 Driver};" ++ 
        "Server=localhost;Database=test;" ++ 
        "User=root;Password=ace152;" ++ 
        "Option=3;", 
    {ok, Conn} = odbc:connect(ConnString, []), 
    Results = odbc:sql_query(Conn, "SELECT * FROM test_table"), 
    {html,"Something here."}. 

</erl> 
于 2013-08-20T11:22:35.287 回答