於是我就跳坑了...
那時候才二年級,什麼架構完全沒有概念,只知道兜出來,就對了,因此很悲劇的結構圖 ORZ...
<?php
//controller.php
interface Controller
{
public function invoke($action,$data);
}
?>
<?php
//model.php
interface Model
{
public function handle_login($table_name,$account,$pwd,$recaptcha);
//public function update_pwd($table_name,$pwd1,$pwd2);
public function check_login($who);
public function get_volunteer_item();
public function admin_volunteer_item();
public function get_checkvolunteer_item();
public function post_user_id($user_id);
public function post_check_item($item_id,$user_id);
public function handle_signup($signId,$signup_open);
public function cloth_set_action($cloth_size);
//more public/private method...
}
?>
<?php
//route.php
require_once("../Controller/controller.php");
$url = $_SERVER["REQUEST_URI"];
$url_arr = explode("=", $url);
$url_len = count($url_arr);
if($url_len>2 || $url_len<2)
{
echo "request-error";
}
else
{
$act_arr = explode("_",$url_arr[1]);
$act_len = count($act_arr);
if($act_len!=3)
{
echo "action-error";
}
else
{
$control = new my_controller();
$data = array();
if(!empty($_POST["data"]))
$data = $_POST["data"];
echo $control -> invoke($url_arr[1],$data);
}
}
?>
//change_pwd.js
$(function(){
$.post("/sports/67/handle/Route/route?action=check_login_student", function(response){
res = $.parseJSON(response);
if(!res["result"]){
location.reload();
}
});
});