Learning purpose:
Block machine requests to ensure that business is not interrupted by machine submission requests.
Why block:
In general server-side business, the consumption caused by write requests is much greater than that of read requests.
Technical points:
1. Implementation of base map and adding interference elements
2. Generate verification content
3. Verification content is saved on the server
4. Verify the effectiveness of the content
Implement the base map:
Code:
<code><span><span><?php</span><span>$img</span> = imagecreatetruecolor(<span>100</span>,<span>30</span>);<span>//大小</span><span>$bgColor</span> = imagecolorallocate(<span>$img</span>,<span>0x00</span>,<span>0x00</span>,<span>0x00</span>);<span>//背景颜色</span> imagefill(<span>$img</span>,<span>0</span>,<span>0</span>,<span>$bgColor</span>);<span>//填充颜色</span> header(<span>'content-type: image/png'</span>); imagepng(<span>$img</span>); <span>//销毁</span> imagedestroy(<span>$img</span>);</span></code>
The above introduces the production of verification codes in PHP, including verification codes and PHP content. I hope it will be helpful to friends who are interested in PHP tutorials.