Sae上使用一輕量ORM庫 idiorm的有關問題

來源:互聯網
上載者:User
Sae上使用一輕量ORM庫 idiorm的問題。
本人小菜,發現一個好用的輕量orm庫idiorm,純粹是覺得方便加上怕自己寫的東西會有安全性問題所以想用這個。

他的文檔如下:http://idiorm.readthedocs.org/en/latest/index.html
Github中地址: https://github.com/j4mie/idiorm

Index.php代碼如下:
require_once "ORM.php";

ORM::configure('mysql:host=localhost;dbname=mydemotest');
ORM::configure('username', 'root');
ORM::configure('password', '123456');
//初始化

ORM::configure('return_result_sets', true);
//

$account = ORM::for_table('account')->create();

$account->id = 11;
$account->account = 1236;

$account->save();

分別用的就是其文檔上的:



以上這段代碼在我本地的xampp上可以運行
但是放到sae上就有問題
我的sae下首先自己建立了一個資料庫,表名是account

然後在我的目錄下遊這兩個檔案,(ORM就是那個idiorm庫)

對應index.php中的代碼是:

require_once 'ORM.php';
ORM::configure('mysql:host=w.rdc.sae.sina.com.cn:3307;dbname=SAE_MYSQL_DB');
ORM::configure('username', 'SAE_MYSQL_USER');
ORM::configure('password', 'SAE_MYSQL_PASS');


$account = ORM::for_table('account')->create();

$account->id = 11;
$account->account = 1236;

$account->save();

?>


然後就出現以下問題:


所以就想請教下各位前輩,自己也百度了很久,實在本人知識水平有限。
謝謝

------解決思路----------------------
SAE_MYSQL_XXXX 是常量!
ORM::configure('mysql:host=w.rdc.sae.sina.com.cn:3307;dbname=' . SAE_MYSQL_DB);
ORM::configure('username', SAE_MYSQL_USER);
ORM::configure('password', SAE_MYSQL_PASS);


另外,主機名稱、連接埠名也應用它提供的常量 SAE_MYSQL_HOST_M、SAE_MYSQL_PORT
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.