
PHP
文章平均质量分 71
EthanQ
这个作者很懒,什么都没留下…
展开
-
php变量作用范围
if(true) { $a = 1; } echo "a---------->".$a; 结果是:a---------->1 没想到变量 a 竟然可以在代码块外使用。 又做了两个两个测试: $c = 4; function test($a) { global $c; $c = 5; $a = 5; echo "b-------->".$a; }原创 2011-11-20 15:05:05 · 641 阅读 · 0 评论 -
PHP 之 串行化与反串行化
对象也是一种在内存中存储的数据类型,他的寿命通常随着生成该对象的程序的终止而终止。有时候可能需要把对象的状态保存下来,需要时再将其回复。串行化是把每个对象转化为二进制字符串。 <?php class Person { var $name; var $sex; var $age; function __construct($name = "", $sex = "男", $age =原创 2012-01-16 13:39:46 · 1466 阅读 · 0 评论 -
PHP 之 冒泡排序
<?php $files = array("file11.txt","file22.txt","file1.txt","file2.txt"); function mySort($arr,$nat=false) { for($i=0;$i<count($arr);$i++) { for($j=0;$j<count($arr)-$i-1;$j++) { if($nat) {原创 2012-01-16 21:21:57 · 783 阅读 · 0 评论 -
PHP 之 表单提交去除斜杠
HTML 表单 请输入一个字符串: <?php if(isset($_POST['submit'])) { //this a "test",5.3.8不自动加斜杠,我测试时是这样的 echo "原型输出:".$_POST['str'].""; echo "转换实例:".htmlsp原创 2012-01-16 20:16:47 · 2352 阅读 · 0 评论 -
PHP 之 字符串处理小结
<?php // 3456 echo substr ( "123456", 2, 4 ); echo ""; $str = "123"; // 不再使用echo $str[1]; echo $str {0}; // this hello today echo "this hello today"; // thisisme echo "this", "is", "me"; ec原创 2012-01-16 20:15:21 · 599 阅读 · 0 评论 -
PHP 之 OOP继承
<?php class Person { var $name;//protected var $sex; var $age; function __construct($name = "", $sex = "男", $age = 22) { $this->name = $name; $this->sex = $sex; $this->age = $age; } f原创 2012-01-15 21:07:51 · 652 阅读 · 0 评论 -
PHP 之 面向对象小例
<?php class Person { private $name; private $sex; private $age; function __construct($name = "", $sex = "男", $age = 22) { $this->name = $name; $this->sex = $sex; $this->age = $age; } /原创 2012-01-15 20:21:57 · 783 阅读 · 0 评论 -
PHP 之 邮件单发小结
这是封装的邮件发送模块类: /* email.class.php */ <? class smtp { /* Public Variables */ var $smtp_port; var $time_out; var $host_name; var $log_file; var $relay_host; var $debug; var $auth;//身份验证 var $user; var $原创 2011-12-27 10:51:31 · 513 阅读 · 0 评论 -
PHP 之 简单ajax Loading加载
var xmlHttp; function createXmlHttpReq() { if(window.ActiveXObject) { xmlHttp = new ActiveXObject('Microsoft.XMLHTTP'); } else if(window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } }原创 2011-12-03 14:23:51 · 2386 阅读 · 0 评论 -
php 之 简单中文验证
img.php <?php session_start(); /*for($i=0;$i<4;$i++) { $rand .= dechex(rand(1,15)); } $_SESSION[check_pic] = $rand; */ $image = imagecreatetruecolor(100, 30); $bg = imagecolorallocate($image, 0,原创 2011-12-01 11:01:46 · 1122 阅读 · 0 评论 -
php 之 FCKeditor2.6
<?php include_once 'fckeditor/fckeditor.php'; //$BasePath = "fckeditor/";//编辑器路径 $BasePath = $_SERVER[PHP_SELF]; $BasePath = dirname($path).'fckeditor/'; $oFCKeditor = new FCKeditor("fck");原创 2011-11-30 17:23:00 · 550 阅读 · 0 评论 -
php 之 水印文字和缩略图
<?php $im = 'xiatian.jpg'; $im2 = 'winter3.jpg'; $img = getImage($im); $bimg = getImage($im2); //$image = getimagesize($im); //print_r($image); //Array ( [0] => 150 width /*[1] => 150 heigh原创 2011-12-01 13:54:57 · 947 阅读 · 0 评论 -
php setcookie 之 Cannot modify header information 解决方法
今天重新回顾一下PHP,其中设置cookie的时候遇到如下问题:Warning: Cannot modify header information - headers already sent by.... 在此把查到的一些有效解决方法贴出来--------------------------------> 解决方法一: 这样的语句,很显然,造成这个原因是因为setcookie造成的,查了一原创 2011-11-20 14:04:35 · 1064 阅读 · 0 评论 -
PHP重定向三种方法
PHP重定向三种方法:: (1).如果要用此方法,在用之前不能有HTML输出。(***) $url="http://winty.ik8.com"; header("Location: $url"); (2). echo "window.location =\"test.php\";"; 或 将window.location换成self.location (3). echo ""; 本文出自 “天堂转载 2012-01-16 20:51:55 · 897 阅读 · 0 评论