每天用 mysql 表中的内容发送用户信息

发布于 2024-12-22 02:52:31 字数 517 浏览 1 评论 0原文

我正在创建一个网站,您可以在其中发布提醒。

我已经尝试了很多,但似乎无法每天向用户发送一封带有提醒的电子邮件。

我可以通过php获取内容,但不知道如何每天自动发送消息。

我如何通过 php 或任何其他方法来做到这一点?

我的数据库看起来像:

Users Table
->User's Row
------->email
------->other fields

Content Table
->User's Post row
------->Content
------->Other

我怀疑数据库结构是否重要,但如果您需要它,它就在那里。

澄清一下:向每个用户发送一封单独​​的电子邮件及其内容。

谢谢

更新:我见过很多人谈论 cron 作业和 perl,但我的托管没有这种支持:(。是否有任何其他解决方案,或者找到单独的 perl 的方法只托管 cron 作业?

I am creating a site which you can post reminders.

I have tried much, but can't seem to be able to send a user an email every day with their reminders in.

I can get the content, through php, but don't know how to automatically send a message every day.

How can I do this through php or any other method?

My database looks like:

Users Table
->User's Row
------->email
------->other fields

Content Table
->User's Post row
------->Content
------->Other

I doubt that the database structure is important, but it is there if you need it.

Just to Clarify: Send each user a seperate email with their content.

Thanks

Update: I have seen a lot of people talking about cron jobs and perl, but I don't have that sort of support for my hosting :(. Are there any other solutions, or a way to find a seperate perl only hosting with just the cron job in?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

叹倦 2024-12-29 02:52:31

必须有一些东西告诉您的 PHP 脚本执行。看看 cron 就可以做到这一点!

假设您的脚本名为 daily-email.php。每天凌晨 4 点运行此脚本的简单 crontab 设置如下:

00 04 * * * /path/to/php /path/to/daily-email.php

Something has to tell your PHP script to execute. Look at cron which does just that!

Say your script is called daily-email.php. A simple crontab setup to run this script daily at 4am would be:

00 04 * * * /path/to/php /path/to/daily-email.php
如何视而不见 2024-12-29 02:52:31

了解 cron 作业 (Linux) 或计划任务 (Windows)。

Read about cron jobs (Linux) or scheduled tasks (Windows).

素染倾城色 2024-12-29 02:52:31

为此,您需要使用 cron 作业,查看您的网络主机是否支持它们。您可以使用 cron 作业定期运行 php 脚本。

to do that, you'll need to use cron jobs, see if your webhost supports them. You can use cron jobs to run php scripts on regular intervals.

皓月长歌 2024-12-29 02:52:31

检查这里:http://en.wikipedia.org/wiki/Cron
编写一个你想要每天执行的脚本(myfile.php),然后执行这个 cron 表达式
0 0 * * * /myfile.php

check here: http://en.wikipedia.org/wiki/Cron
write a script(myfile.php) that u want to be executed everyday, thn execute this cron expression
0 0 * * * /myfile.php

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文