img src php counts the number of emails opened

巴扎黑
Release: 2016-11-22 15:52:18
Original
1581 people have browsed it

The way to count the number of times an email is opened is basically to put a picture in the email, and then count the number of times the picture is opened

mail.html

This way you can The log counts the number of times the image has been opened, but there is an error in the number of times counted. For example, the user opens it multiple times, etc.

In fact, you can also write like this in the email, directly point the src to a php file, and then output the image in the php file.

First try:

mail.html

mail.php

die('mail.jpg');

Open the email like this Sometimes mail.php returns mail.jpg (image address), but the image cannot be loaded.

After a simple check, the header information of the src request in html is Accept: image/png, image/*; q=0.8,*/*; q=0.5, so it is incorrect to output mail.jpg directly. It should be Output the contents of the image.

Modified:

mail.php

readfile('mail.jpg'); //file_get_contents('mail.jpg'); You can also

This way you can count the detailed information of email openings

Of course, you don’t have to worry about this if you don’t display the image. Just modify the img style in the html.


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!