学习笔记

PHP图像字符水印居中

[php]
<?php
//让图像上字符串居中
header("content-type:text/html;charset = utf-8");
//(1)创建画布
$filename = "./images/02.jpg";
$img = imagecreatefromjpeg($filename);
$str = "WELCOME to liuguofeng.com";
$font = 5;
//(2)分配颜色:
$color1 = imagecolorallocate($img,255,0,255);[……]

Read more

Continue Reading
学习笔记

PHP通过HTTP请求防盗链

anti-theft_chain.php

[php]
<?php
header("content-type:text/html;charset=utf-8");
if(isset($_SERVER[‘HTTP_REFERER’]))
{
//域名对比,一致下载,不一致跳转到错误页面
//strpos: 查找字符串首次出现的位置
if(strpos($_SERVER[‘HTTP_REFERER’],"http://www.misswell.net")===0)
{
echo "您可以下载软件了"[……]

Read more

Continue Reading
学习笔记

PHP隐藏下载地址

download.php

[php]
<?php
//获取传递的文件名
$filename = $_GET[‘filename’];
$pathname = “$./download/$filename”;
//以只读方式打开文件
$handle = fopen($pathname,”rb”);
//返回数据的内容类型
//’octet-stream’八位二进制流
//’content-desposition:attachment’以附件形式打开
header(“content-type:application/octet-stream”);
header(“co[……]

Read more

Continue Reading
学习笔记

MySQL初始化配置

安装 mysql-5.5.24-win32.msi

设置密码 root

测试是否安装成功

CMD下

set path

mysql.exe -hlocalhost -uroot -proot

msohtmlclipclip_image001

修改php配置文件php.ini(复制php.ini-development进行修改)

msohtmlclipclip_image002

开启PHP扩展文件目录

extension_dir = “ext”

msohtmlclipclip_image003

extension=php_mysql.dll

msohtmlclipclip_image004

当Apache启动时,指定php.ini文件的路径

PHPIniDir “C:\wamp\PHP5″[……]

Read more

Continue Reading
学习笔记

PHP初始化配置

解压到安装目录

msohtmlclipclip_image001[4]

在Apache里加载PHP5模块,并指定扩展名与文件内容进行绑定

#Apache启动时,去加载PHP5的模块

LoadModule php5_module C:\wamp\PHP5\php5apache2_2.dll

#将指定的扩展名,与文件内容进行绑定

AddType application/x-httpd-php .php .html

msohtmlclipclip_image002[4]

配置环境变量

msohtmlclipclip_image003[4]

修改php配置文件php.ini(复制php.ini-development进行修改)

msohtmlclipclip_image004[4]

开启PHP扩展文件目录

extension_dir =[……]

Read more

Continue Reading