如何在Linux文件中的PHP文件中重定向cron作业中的URL? [英] How to redirect a URL in cron job at Linux Server in PHP file?

查看:55
本文介绍了如何在Linux文件中的PHP文件中重定向cron作业中的URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,

我想执行一个 URL 重定向,在该重定向中我必须调用网关服务器才能发送短信.我要重定向URL的服务器基于Linux,文件代码基于PHP.特定的php文件是作为 cron作业执行的.

由于Cron作业在backgroud中运行,因此我们无法重定向(不允许使用Response.redirect("url")).那么如何才能完成上述任务?

谢谢

Varun Sareen
软件开发人员

Dear Friends,

I want to execute a redirect a URL in which i have to call a gateway server in order to send a sms. The Server on which i want to redirect a url is Linux based and the file code is on PHP. The particular php file is executed as a cron job.

As a cron job runs in backgroud, we are not able to redirect (Response.redirect("url") not allowed). how one will be able to do the above task then?

Thanks

Varun Sareen
Software Developer

推荐答案

如果您将php文件作为cron作业运行,则重定向是没有意义的.让cron任务也执行另一个php文件.

看看wget.

检查 http://www.htmlcenter.com/blog/running-php-scripts-with- cron/ [^ ]
Redirection is meaningless if you run the php file as a cron job. let the cron task execute the other php file also.

Have a look at wget.

Check http://www.htmlcenter.com/blog/running-php-scripts-with-cron/[^]


这篇关于如何在Linux文件中的PHP文件中重定向cron作业中的URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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