我有一個表格,並提交表單的URL會動態地生成jQuery的動態URL
var Var1 = new Array();
var Var2 = new Array();
if(Var1.length === 0)
$(this).attr('action', 'http://localhost/Method').submit();
if(Var1.length != 0 && Var2.length === 0)
$(this).attr('action', 'http://localhost/Method/Var1').submit();
if(Var1.length != 0 && Var2.length != 0)
$(this).attr('action', 'http://localhost/Method/Var1/Var2').submit();
和所有的URL大火服務器的一種方法,它是
public function Method(){}
public function Method(Var1){}
public function Method(Var1 , Var2){}
反正有將所有最後3種方法作爲一種方法?是這樣的:
public function Method(Var1, Var2){
if( condition for Var1){// doSomthing}
if( condition for Var2){// doSomthing}
}
你使用任何框架? –
請縮進你的代碼,我們不應該爲你做。 – gdoron
@gdoron我正在談論PHP的結局。他使用任何PHP框架? –