简体   繁体   English

如何在ios解析服务器端执行php脚本?

[英]how to execute php script in ios parse-server side?

my iOS swift app is deployed in heroku using Parse SDK, my question is how to execute php script in parse-server side when an action happend in ios app , eg: send confirmation email when new user signup using ios app by executing php script in the server side. 我的iOS swift应用程序是使用Parse SDK部署在heroku中的,我的问题是当ios应用程序中发生操作时,如何在解析服务器端执行php脚本,例如:通过在ios中执行php脚本使用ios应用程序注册新用户时发送确认电子邮件服务器端。

any idea ? 任何想法 ?

Thanks 谢谢

Parse server is based on NodeJS and not PHP. 解析服务器基于NodeJS而非PHP。 the only scripts that you can execute in parse-server should be written in NodeJS. 您可以在parse-server中执行的唯一脚本应使用NodeJS编写。 If you have some 3-party scripts written in PHP and those scripts are exposed in REST api you have 2 options: 如果您有一些用PHP编写的3方脚本,并且这些脚本在REST api中公开,则有2个选项:

  1. Call those scripts from within the parse-server cloud code env. 从解析服务器云代码环境中调用这些脚本。 (with a very simple NodeJS call to your php rest API) (通过对您的php rest API的非常简单的NodeJS调用)
  2. call those scripts from within your IOS client and handle the results on the client 从您的IOS客户端中调用这些脚本并在客户端上处理结果

[EDIT] in order to execute scripts when events occurs (eg user created, class updated etc) you can use cloud code triggers [EDIT]为了在事件发生时执行脚本(例如,用户创建,类更新等),您可以使用云代码触发器

for example a code that will be executed before a user is saved to the database is (from parse cloud code docs) : 例如,在将用户保存到数据库之前将执行的代码是(来自解析云代码文档):

Parse.Cloud.beforeSave(Parse.User, function(request, response) {
  if (!request.object.get("email")) {
    response.error("email is required for signup");
  } else {
    response.success();
  }
}); 

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用php parse-server sdk将ParseQuery :: orQueries与matchsQuery结合使用 - How do you combine ParseQuery::orQueries with matchesQuery using the php parse-server sdk 每次在客户端增加变量时如何在服务器端(php)执行代码(java脚本) - how to execute the code on server side (php) each time the variable is incremented on the client side (java script) 如何在服务器端执行未来付款(Paypal REST IOS API)(使用Php curl) - How to execute Future payments (Paypal REST IOS API) on server-side (using Php curl) 通过网页在服务器端执行PHP脚本 - Execute server-side execution of PHP script via webpage PHP如何使函数在客户端而不是服务器端执行 - php how to make a function execute in client side instead of server side PHP服务器端脚本 - PHP Server Side Script 如何使用php构建服务器端脚本 - how to structure server side script with php 如何在服务器端调度 PHP 脚本的执行? - How to schedule the execution of a PHP script on the server side? Firebase:如何使用php服务器端脚本检查客户端会话 - Firebase: how to check client side session with php server side script 如何在iOS上使用Swift在IOS上解析JSON(从PHP服务脚本发送)? - How to Parse a JSON with Swift on IOS, sent from a PHP service script?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM