dongqing5575 2012-06-04 19:56
浏览 14
已采纳

访问PHP函数的替代方法

Currently, I'm developing an application using standard PHP. As such, there are assorted functions that are called from forms. Some examples include registration, login, logout, and others.

Rather than creating a separate file for each function, I'm using a phpscripts.php file in the includes folder. To execute a function from html input, I pad the URL with ?action=functionName. Inside the script file, I use a switch/case tree to execute the proper function based on the S_GET['action'] variable.

Is there a better way to implement HTML calls to PHP functions?

  • 写回答

2条回答 默认 最新

  • duanpenpan5796 2012-06-04 19:59
    关注

    No, that is the correct way to interface a HTML form with a PHP script. Other alternatives would include employing URL rewriting (to convert something like /actions/functionname/param to ?action=functionname&param=x), but the basic principle remains the same.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改