锘??xml version="1.0" encoding="utf-8" standalone="yes"?>1. 鍏充簬BAE
閮ㄧ講鍦˙AE涓婇潰錛孊AE榪樻槸寰堢粰鍔涚殑銆傚浜庢垜絳夎垗涓嶅緱鑺遍挶涔扮┖闂寸殑鐮佸啘鏉ヨ錛岃繕鏄竴涓闊籌紝鑰屼笖瀹冪粰寰楀厤璐歸厤棰濇槸寰堝ぇ鐨勶紝璧風(fēng)爜姣擲AE澶э紝閫熷害涔熶笉閿欙紝鏀寔鐨勮璦鐜涔熸瘮杈冨錛?br />鏈漢鍦ㄤ笂闈㈠氨閮ㄧ講浜?jiǎn)PHP錛宯ode.js鍜孭ython涓変釜銆?br /> 涓嶈繃闇瑕侀厤緗甎RL錛屽叾瀹炲氨鍜屽湪web.py閲岄潰閰嶇疆鐨勫樊涓嶅錛屼笉榪囧氨鏄鎴戜滑榪樿鍦˙AE閲岄潰(app.conf)鍐嶈緗竴涓嬬艦浜?jiǎn)銆?br />
script : index.py
- url : /new
script : index.py
- url : /view/(\d*)
script : index.py
- url : /delete/(\d+)
script : index.py
- url : /login/?
script : index.py
- url : /edit/(\d+)
script : index.py
- url : /tag/(\d+)/?(\d*)
script : index.py
- url : /search/([^\s/]+)/?(\d*)
script : index.py
- url : /date/(\d+)/?(\d*)
script : index.py
- url : /month/(\d+)/?(\d*)
script : index.py
- url : /year/(\d+)/?(\d*)
script : index.py
- url : logout/?
script : index.py
- url : /static/(.*)
script : index.py
鍙笉榪囧畠鐨勬枃浠剁郴緇熶笉鑳芥寔涔呭寲錛屾墍浠ヨ嚦浜庝笂闈㈠浘鐗囩瓑錛屽彲浠ヨ冭檻瀛樺埌鏁版嵁搴擄紝鎴栬呮槸閲囩敤鍏朵粬鐨勫浘鐗囨湇鍔°?br />2. 鍏充簬Web.py
棣栧厛娌夐噸鎮(zhèn)煎康 Aaron Swartz銆?br /> web.py鏄緢綆鍗曠殑錛屽儚榪欐牱錛?br />
r'/(\d*)', 'Index',
)
def GET(self, page):
""" Show page """
#鍋氫綘鎯沖仛鐨?/span>
return render.index(浼犳暟鎹?
def POST(self, page):
return render.index(浼犳暟鎹?3. 緇撳悎web.py鍜孊AE
鍦˙AE涓婇潰榪愯web.py鏈変竴浜涚壒璁哥殑閰嶇疆銆?br /> mysql錛?/strong>
mydb = MySQLdb.connect(
host = const.MYSQL_HOST,
port = int(const.MYSQL_PORT),
user = const.MYSQL_USER,
passwd = const.MYSQL_PASS,
db = dbname)
榪愯web.py:
from bae.core.wsgi import WSGIApplication
application = WSGIApplication(app)
]]>
/*瀹氫箟緋葷粺榛樿鐨勮嚜鍔ㄥ姞杞藉嚱鏁?/
function __autoload($className){
if(file_exists($className.'.php')){
require_once($className.'.php');
}
}
// 娉ㄥ唽鑷繁鐨勮嚜鍔ㄥ姞杞藉嚱鏁?br />//function autoload(){
// if(file_exists('Test.php')){
// require_once('Test.php');
// }
//}
//
//spl_autoload_register('autoload');
// 綾繪柟寮忕殑瀹炵幇錛屾敞鎰忓姞杞藉嚱鏁板繀欏繪槸闈?rùn)鎬佸嚱鏁?br />//class Myloader{
// static function autoload(){
// if(file_exists('Test.php')){
// require_once('Test.php');
// }
// }
//
//}
//
//spl_autoload_register(array('Myloader', 'autoload'));
$test = new Test();
$test2 = new Test2();
// 鍦ㄤ竴涓枃浠朵腑瀹氫箟澶氫釜綾諱篃鏄彲浠ヨ嚜鍔ㄥ姞杞界殑
$my = new MyClass('鏉庡痙鎴?,'濂?);
$my->personInfo();
// 濡傛灉鎴戝皢PHP涓墍鏈夌殑鎺у埗鍙?qiáng)涓氬姟浠g爜閮界敤绫荤殑鏂瑰紡瀹氫箟锛岄偅涔垶畣涓嶉渶瑕佽繘琛屼換浣曠殑欏甸潰鍖呭惈
// 灝嗗崄鍒嗘柟渚匡紝鑰屼笖涓嶅鏄撳嚭閿?br />// 浣犲繀欏諱繚璇佷綘鐨?PHP 5 >= 5.1.2)鎵嶈兘浣跨敤
?>