|
|
|
|
|
|
ASPX和Ajax结合使用的例子
摘要:[Ajax测试] Test using System;using System.Web.Services; //Mustpublic partial class index : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { } [WebMethod] public static string getReturn(string name,int a...
阅读全文
ASPX如何调用外界程序
摘要:调用外界程序,用到Process类,这个相当于在运行中输入命令,而不是在cmd中输入命令。.aspx.cs页,Start方法应该是静态方法1 using System.Diagnostics;2 .....3 Process.Start("cmd",@"/c shutdown -l");
阅读全文
ASPX页显示数据的两种办法【公共变量或者方法】以及对数据的渲染
摘要:1 2 3 4 5 6 7 8 13 14 15 16 17 18 19 20 的网址是:21 22 23 24 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Web; 5 using System.Web.UI; 6 using System.Web.UI.WebControls; 7 8 public partial class index : S...
阅读全文
ASPX防止重复执行Page_Load以及事件绑定的问题
摘要:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Web; 5 using System.Web.UI; 6 using System.Web.UI.WebControls; 7 8 public partial class index : System.Web.UI.Page 9 {10 protected...
阅读全文
php类的继承,重载,扩展
摘要:1 buluo = $buluo;16 $thhis->height = $height;17 $this->weight = $weight;18 }19 //用于重载的方法20 public function cry(){21 echo '555 and I am from '.$this->buluo.'.'; 22 } 23 //用于继承的方法24 public function smile(){25 echo 'I am smiling.';26 }...
阅读全文
[转载]php方法重载
摘要:地址:http://www.nowamagic.net/php/php_Override.php如果从父类继承的方法不能满足子类的需求,可以对其进行改写,这个过程叫方法的覆盖(override),也称为方法的重载。当对父类的方法进行重写时,子类中的方法必须和父类中对应的方法具有相同的方法名称,在PHP5中不限制输入参数类型、参数数量和返回值类型。(这点和Java不同)。子类中的覆盖方法不能使用比父类中被覆盖方法更严格的访问权限。声明方法时,如果不定义访问权限。默认权限为public。PHP5重写方法先设置一个父类,这个父类是 “Dog”类,这个类描述了dog的特性。Dog有2个眼睛,会跑,会叫
阅读全文
自己封装的mysql类
摘要:1 host = $host;11 $this->uid=$uid;12 $this->pwd = $pwd;13 $this->db=$db;14 $this->link = mysql_connect($this->host,$this->uid,$this->pwd) or 15 die('Not connect to mysql '.mysql_error());16 $this->switch_db($this->db);17 mysql_query('set names...
阅读全文
MySQL防注入[待续]
摘要:1.将输入的参数变成整数$id = isset[$_GET['tid']]?$_GET['tid']+0:0;可以防止:"*.php?tid=3 or 1"这样的语句.
阅读全文
return,exit,die
摘要:return:代表退出某个函数,但是函数体外的语句仍然需要执行。exit:退出程序,但是不从内存中卸载,exit其实也是可以输出语句的,加一个括号即可。die:退出程序,并且从内存中卸载。
阅读全文
PHP中变量,常量,超级全局变量小结
摘要://一般来说,变量在函数无法在函数体中无法访问,但是常量可以。//超级全局变量确实可以的,地址栏上的参数/*$GLOBALS //变量注册的信息$_GET //地址栏参数$_POST //表单参数常用这个来接$_REQUEST //可以接$_GET,$_POST,$_COOKIE的参数,是他们的并集。$_FILES //文件上传$_COOKIE //用户登录$_SESSION //用户登录$_SERVER //服务器以及访客信息$_ENV //服务器以及访客信息*/$var1 = 5; $var2 = 1; // 普通全局变量,在GLOBALS里注册 function get_value().
阅读全文
PHP和CS的引用传值
摘要:PHP的引用传值function change_value($num){ $num+=2;}$age = 3;change_value(&$age);echo $age;CS的引用传值static void Main(string[] args){ int age = 3; Console.WriteLine(change_value(ref age));}static int change_value(ref int num){ num += 2; return num;}
阅读全文
PHP动态函数
摘要:header('Content-type:text/html;Charset=utf8');function welcome(){ echo 'Welcome to you.';}function speak(){ echo 'Hello,my name is xtyang.';}$func = $_GET['func'];echo $func();
阅读全文
list笔记总结
摘要:1.list是一个复合的复制函数,可以将一个数组一次赋给多个变量。我们常用以下语句遍历一个数组。$arr = array('东','男','西','北');while(list($k,$v)=each($arr)){ echo $k.'=>'.$v.'';}2.从上边可以看出,each($arr)似乎是一个包含两个元素的数组,实际不是。var_dump(each($arr));res:{ [1]=> string(3) "东" ["value"]=
阅读全文
PHP浮点数的精度
摘要:在百度知道上看到这么一个问题var_dump((0.3-0.2)==0.1);结果是:false后来查查手册,原来是浮点数的精度问题。那么0.3-0.2-0.1等于多少呢,结果:2.7755575615629E-17如果真的涉及到浮点数的比较,可以这样,设计一个精度,就可以比较了。$ps = 2.7755575615629*pow(10,-16);$_ps = -2.7755575615629*pow(10,-16);$flags = "false";if((0.3-0.2-0.1)$_ps){ $flags = "true";}echo "0
阅读全文
PHP与MySQL中编码的设置
摘要:php代码header("Content-type:text/html;Charset=utf8");myql_query("set names utf8");
阅读全文
PHP分页
摘要:[资源下载] "; echo "ID姓名"; echo "密码年龄"; while($rows = mysql_fetch_assoc($res)){ echo "$rows[id]$rows[name]"; echo "$rows[password]$rows[age]"; } echo "前一页"; echo "后一页"; echo ""; ?>
阅读全文
PHP面向对象之将数据库的查询结果序列化成json格式
摘要:host = $_host; $this->uid = $_uid; $this->pwd = $_pwd; $this->db = $_db; $this->link = mysql_connect($this->host,$this->uid,$this->pwd); mysql_select_db($this->db,$this->link); } function exec_sql($sql){ //if you use insert sentence,then you must open your link; $res = mys
阅读全文
PHP与javascript实现变量交互
摘要:";就会出错,因为$title在php中被赋值为数组 * 尽管在php的flags=="false";$title是一个字符串,情况是$title是数组,而数组在字符串中也是不能直接显示的。*/ $string = "天上and地下";$flags = "";if(strpbrk($string,"and")!=false){ $title = explode("and",$string); $title_1 = $title[0]; $title_2 = $title[1]; $fl
阅读全文
[转载]JSON序列化与反序列化
摘要:转载:http://www.cnblogs.com/ejiyuan/archive/2010/04/09/1708084.html方法一:引入System.Web.Script.Serialization命名空间使用 JavaScriptSerializer类实现简单的序列化序列化类:PersonnelpublicclassPersonnel{publicintId{get;set;}publicstringName{get;set;}} 执行序列化反序列化:代码protectedvoidPage_Load(objectsender,EventArgse){Personnelpersonne.
阅读全文
|
|
xtyang copyright©2013-2013,邮箱:xtyang@live.com