<? // start at the top of the page since we start a session session_name('mysite_hit_co…
支持文字水印、图片水印支持水印的位置随机或固定(九宫格)水印透明度设置(图片水印和文字水印都支持)文字 水印的字体、颜色、大小设置图片水印的背景透明 <?php /** * …
之前我们提供了如何使用 Mandrill 发送邮件的 PHP 代码片段,但是如果你不想使用第三方服务,那么可以使用下面的 PHP 代码片段。 function send_mail(…
这个 PHP 片段可以帮助你让用户登录后直接跳转到之前浏览的页面 function current_url() { $url = "http://" . $_S…
function unzip($location,$newLocation) { if(exec("unzip $location",$arr)){ mkdir…
$json_string='{"id":1,"name":"rolf","country":&quo…
function resize_image($filename, $tmpname, $xmax, $ymax) { $ext = explode(".", $…
$xml_string="<?xml version='1.0'?> <moleculedb> <molecule name='Benzin…
使用下面的 PHP 片段可以即时压缩 zip 文件 function create_zip($files = array(),$destination = '',$overwrit…
如果你需要下载特定的文件而不用另开新窗口,下面的代码片段可以帮助你。 function force_download($file) { $dir = "../log/ex…
这个代码片段可以方便你禁止某些特定的 IP 地址访问你的网站 if ( !file_exists('blocked_ips.txt') ) { $deny_ips = array(…
<?php /*给图片加文字水印的方法*/ $dst_path = 'http://xxx.jpg'; $dst = imagecreatefromstring(file_g…