2017-11-17 04:15
浏览 99

在CodeIgniter中使用$ _POST值

Application makes an AJAX request to a method in a controller.

The controller then calls a method in the model to run a query on the DB and then return the results.

AJAX "type" specified as POST.

Even though $_POST superglobal values are available for use in model, should one still list the $_POST values in the model method signature?

I'm thinking this is best practice so people dissecting a system can quickly see inputs going into model methods


public function attendance_history_get($students_id,$start,$end)



and then just using the available $_POST values in model method attendance_history_get()

图片转代码服务由CSDN问答提供 功能建议




即使$ _POST超全局值可用于模型,是否仍然会在模型方法签名中列出$ _POST值?

我认为这是最佳实践,因此人们解剖 系统可以快速查看进入模型方法的输入

  $ this-> Students_table_model-> attendance_history_get($ _ POST ['students_id'],$ _ POST ['start_date']  ,$ _ POST ['end_date']); 
公共函数attendance_history_get($ students_id,$ start,$ end)

VS $ this-> Students_table_model-> attendance_history_get();

然后只使用模型方法中的可用$ _POST值 attendance_history_get()

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题