如何通过点击电子邮件中发送的超链接将用户重定向到移动应用程序或网站?是否需要使用PHP在服务器端处理? [英] How to redirect the user to a mobile app or a website on click of a hyperlink sent in an email? Should it need to be handled on server-side using PHP?

查看:156
本文介绍了如何通过点击电子邮件中发送的超链接将用户重定向到移动应用程序或网站?是否需要使用PHP在服务器端处理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个已经使用 PHPFox 开发的网站,它运行正常。现在,iOS开发团队已经在iOS中创建了一个移动应用程序,其功能与网站相同。用户可以使用此应用程序执行所有操作,他/她可以在网站上执行此操作。换句话说,我们可以说这个应用程序是现有网站的复制品。开发应用程序的唯一限制是流程和功能应与网站相同。应用程序与现有运行网站之间不应存在任何功能差异。

I've a website which is already developed using PHPFox and it's working fine. Now, iOS development team has created a mobile app in iOS for the same functionality as of the website. User can do all the operations using this app which he/she can do on a website. In other words we can say this app is a replica of the existing website. The only restriction in development of app is that the flow and functionality should be same as of the website. There should not be any functionality discrepancy between the app and the existing running website.

对于这个应用程序,他们使用与网站的PHPFox代码库相同的功能。我通过使用Slim框架开发的REST API为iOS团队提供了这些功能。在这些API中,我接受来自应用程序的JSON格式的请求,解码它,通过传递所需的请求参数从PHPFox代码库调用所需的函数,从函数获取响应,将其转换为JSON格式并将其发送回移动应用程序。

For this app, they are using the same functions present into the website's PHPFox code base. I'm making the iOS team these functions available by means of REST APIs developed using Slim framework. In these APIs I'm accepting the request in JSON format from the app, decode it, call the required function from PHPFox code base by passing the required request parameters, get the response from the function, convert it into JSON format and send it back to the mobile app.

现在,让我们关注我所面临的问题。

Now, let's focus on the issue I'm facing.

场景(网站和应用程序)用于某些功能,如新用户帐户激活链接,重新发送帐户激活链接,重置现有用户密码,如果他/她忘记密码等,则会向相关用户发送电子邮件。此电子邮件包含相关的超链接。当用户点击发送到电子邮件中的此超链接时,它总是会重定向到网站上的相应网页。

In both the scenarios(website and app) for some functionalities like new user account activation link, resend account activation link, reset existing user's password if he/she forgets password, etc. an email is sent to the concerned user. This email contains the relevant hyperlink. When user clicks on this hyperlink sent into the email, it always redirects to the respective web page on website.

当该特定用户点击收到的邮件中的超链接时它会被重定向到网站。它不会重定向到应用程序。

When that specific user clicks on the hyperlink present into the received mail it gets redirected to the website only. It doesn't redirect to the app.

我的要求是,如果用户已将邮件打开到已安装/运行移动应用程序并点击了邮件中的超链接他/她应该重定向到移动应用程序的特定页面而不是网站。

My requirement is if user has opened the mail on to the device which also has installed/runs the mobile app and clicks on a hyperlink in a mail he/she should redirect to the specific page of mobile app not the website.

并假设用户是否在计算机,笔记本电脑或计算机上打开过邮件未安装应用程序的设备,他/她应该重定向到网站。

And suppose if user has opened a mail on a computer, laptop or a device where the app is not installed he/she should redirect to the website.

我应该如何实现这一目标?

How should I achieve this?

此处需要注意的另一件事是要发送到邮件的链接的重定向路径( href 属性的值)是仅生成到网站的PHPFox代码中。那么,如果我需要改变逻辑来实现这个新功能,我该如何做而不改变应用程序和网站上的系统流程?或者我应该为它编写一个新函数,以便不更改PHPFox的现有代码?

One more thing to be noted here is the redirection path(value of the href attribute) of the link to be send into the mail is generated into the website's PHPFox code only. So, if I need to make change into the logic to achieve this new functionality how should I do without changing the system flow on app and website? Or should I write a new function for it in order to not change the existing code of PHPFox?

我研究了这个问题的解决方案。我开始了解 Bitly 可以完成这项工作,但却无法理解。

I researched about the solution to this issue. I came to know about Bitly that could do this job but couldn't understand how.

iOS团队根据这篇超链接文章。请参考这个。

This requirement is raised by iOS team to me (PHP team) on the basis of this hyperlink article they have found on the internet. Please refer this also.

所以,我直截了当的问题是因为这篇文章是关于iOS编码的,它与服务器端编码(即PHP)没有任何关系我应该做什么服务器端使用PHP实现此功能的任何内容?

So, my straight-forward question is since this article is about iOS coding and it nothing has to do with server-side coding (i.e. PHP) should I have to do anything on server-side using PHP to achieve this functionality?

推荐答案

您(或您的iOS团队)需要添加URL计划到iOS应用程序,使深层链接成为可能。然后你需要一个网站来检查这个URL方案(以及iOS应用程序)是否在设备上可用。如果是,那么你转发到应用程序,如果没有你转发到网站。然后,您将链接嵌入到电子邮件中的支票网站。

You (or your iOS-team) need to add an URL scheme to the iOS app to make deep linking possible. Then you need a website which checks if this URL scheme (and therefore the iOS app) is available on the device. If yes, then you forward to the app, if no you forward to the website. Then you embed the link to the check website in your emails.

有些服务可以帮助您完成整个设置。我所知道的是 https://branch.io ,但我相信还有更多。

There are services, which can help you with the whole setup. One I know is https://branch.io but I'm sure there are more out there.

编辑:

iOS中的深层链接: http://blog.originate.com/blog/2014/04/22/deeplinking-in-ios/

Deep Linking in iOS: http://blog.originate.com/blog/2014/04/22/deeplinking-in-ios/

从该链接:要启用深层链接,请转到Xcode项目中的信息选项卡。在URL类型部分中,单击+按钮,然后添加标识符确保您选择的标识符和URL方案是唯一的。记下您输入的URL方案,因为iOS知道如何在您的应用中打开链接。

From that link: "To enable deep linking, go to the Info tab in the Xcode project. In the URL Types section, click on the + button, and then add an identifier and a URL scheme. Ensure that the identifier and URL scheme you select are unique. Take note of the URL scheme you enter, as this is how iOS knows to open a link in your app."

还有更多步骤要遵循,所以请务必阅读全部内容。

There are more steps to follow, so make sure to read the whole thing.

为iOS和Web创建链接:

Create a link for iOS and Web:

创建一个li nk要么启动iOS应用程序,要么重定向到应用程序商店

是否可以注册一个http基于域名的iPhone应用程序的URL方案,如YouTube和地图?

而不是重定向到AppStore,您想重定向到您的网页。

instead of redirecting to the AppStore, you'd like to redirect to your webpage.

这篇关于如何通过点击电子邮件中发送的超链接将用户重定向到移动应用程序或网站?是否需要使用PHP在服务器端处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆