随笔分类 -  php/mysql

php(超文本预处理器—Hypertext Preprocessor)是一种服务器端,跨平台,面向对象,HTML嵌入式的脚本语言。
超链接传递数值
摘要:<a href="#" name=name target="target">连接文字</a><a href="1.php? id=<?php echo $errat['id'];?>">连接字段</a><a href="1.php? id=".urlencode($)."&username=".erlcode()." ">连接字段</a>通过$_get[' 阅读全文
posted @ 2012-05-31 16:06 ms.元 阅读(522) 评论(0) 推荐(0)
页面刷新技术
摘要:<a href="javascript:location.reload()" target=“_self">刷新页面</a><meta http-equiv="refresh" content="2:url=index.php"/> 阅读全文
posted @ 2012-05-31 15:59 ms.元 阅读(212) 评论(0) 推荐(0)
php注销代码
摘要:<a href="logout.php" style="color:#F09;">注销</a><?phpsession_start();session_destroy();header("location:index.php");?> 阅读全文
posted @ 2012-05-31 15:53 ms.元 阅读(1946) 评论(1) 推荐(0)
[php]IP地址转化为对应的数字
摘要:<?php echo ip2long("192.168.1.189")."<br>"; echo (192*255*255*255+168*255*255+1*256+189)."<br>";?>-10627313313194548645 阅读全文
posted @ 2012-05-22 22:50 ms.元 阅读(803) 评论(2) 推荐(0)
php自定义函数替换超长文本中的特殊字符
摘要:function unhtml($content){$content=htmlspecialchars($content);$content=str_replace(chr(13),"<br>",$content);$content=str_replace(chr(32),"<br>",$content);$content=str_replace("[_[","<",$content);$content=str_relace(")_)",">&quo 阅读全文
posted @ 2012-05-21 22:25 ms.元 阅读(683) 评论(2) 推荐(0)
php:undefined index的几种解决方法
摘要:平时用$_post[''],$_get['']获取表单中参数时会出现Notice: Undefined index: --------;虽然可以通过设置错误显示方式来隐藏这个提示,但是这样也有隐患,就是在服务器的日志中会记录这些提示,导致日志文件异常庞大。通过在网上搜索和自己自身的实战总结几种解决方法;方法1:服务器配置修改修改php.ini配置文件,error_reporting = E_ALL & ~E_NOTICE方法2:对变量进行初始化。方法3:做判断isset($_post['']),empty($_post['' 阅读全文
posted @ 2012-05-17 16:50 ms.元 阅读(14764) 评论(1) 推荐(2)
mysql总结
摘要:学习mysql之后的一点总结1.想要在命令提示符下操作mysql服务器,添加系统变量。(计算机-系统属性——环境变量——path)2.查询数据表中的数据;select selection_list select * /columnsfrom table_list from table1/table2where primary_constraint group by grouping_columnsorder by sorting_colomns desc降序 select * from table order by id desc;having second_constraint ... 阅读全文
posted @ 2012-05-14 21:32 ms.元 阅读(402) 评论(0) 推荐(0)
php文件操作
摘要:<?phpif(!is_dir('txt'))//判断txt是否为文件夹目录{mkdir('txt');//创建名为txt的文件夹目录$open=fopen('txt/in.txt',"w+");//以读写的方式打开文件 if(is_writable('txt/in.txt'))//如果此文件为可写模式 { if(fwrite($open,"今天是美好的一天,一定要开心哦!《- -》")>0)//写入内容 fclose($open);//关闭文件 echo "<s 阅读全文
posted @ 2012-05-10 16:30 ms.元 阅读(470) 评论(0) 推荐(0)
PHP图片验证码制作(中)
摘要:随机生成数字,字母的代码:<?php//che.phpsession_start();for($i=0;$i<4;$i++) { $rand.=dechex(rand(1,15)); } $_SESSION['check_num']=$rand;$image=imagecreatetruecolor(50,30);$bg=imagecolorallocate($im,0,0,0);//第一次用调色板的时候,背景颜色$te=imagecolorallocate($im,255,255,255);imagestring($image,6,rand(0,20),rand( 阅读全文
posted @ 2012-05-10 10:30 ms.元 阅读(938) 评论(0) 推荐(0)
PHP图片验证码制作(上)
摘要:最近正在学习php入门,现在刚入门,所以许多都不知道,就从最基础的学起,不会的上网查,然后把它记在这个法宝内,就如今天遇到随即函数rand();脑海中想到用它做点啥好呢,最后想起了验证码,数字验证码,字母验证码,中文验证码,可是自己不会呀,咋办呢,上网搜,看别人的代码,开不懂,看视频,听老师讲,将其中所遇到的函数,值得注意的地方都拿笔记下,平常看到一般网页上的随机验证码都是以一定的方框包围起来,貌似就是以图片为背景的。经过边看,自己边敲,虽然遇到很多不会的问题,但是我相信只要自己脚踏实地,一定学会的。现在想做一下总结,自己可能写的很乱,可我相信有一天会实现的。1.产生数字的随机数 ——》创建图 阅读全文
posted @ 2012-05-09 22:37 ms.元 阅读(1657) 评论(0) 推荐(0)
常用的预定义变量
摘要:<?phpecho "当前操作系统信息".PHP_OS."<br/>";echo '本文件路径和文件名为:'.__FILE__.'<br />'; echo "当前PHP版本信息".PHP_VERSION."<br/>";?> 阅读全文
posted @ 2012-05-07 21:27 ms.元 阅读(440) 评论(0) 推荐(0)
php注释风格
摘要:<?phpecho "使用C++注释风格";//单行注释,注:单行注释中注意“?>”标志echo "使用C风格注释";/*多行注释*/echo "使用shell脚本风格注释";#?> 阅读全文
posted @ 2012-05-07 20:56 ms.元 阅读(248) 评论(0) 推荐(0)
php标记
摘要:2012-05-07 20:51:42 1 <?php 2 echo "这是XML标记风格<br>";//推荐风格 3 ?> 4 <script language="php"> 5 echo "这是脚本风格标记<br>"; 6 </script> 7 <? 8 echo "这是简短风格标记";//php.ini中"short_open_tag"=on; 9 10 ?>11 12 <%13 echo "这是AS 阅读全文
posted @ 2012-05-07 20:49 ms.元 阅读(256) 评论(0) 推荐(0)
PHP连接MYSQL(代码)
摘要:<?php$db_host='hostname is database server ';$db_database='database name';$db_username='username';$db_password='password';$connection=mysql_connect($db_host,$db_username,$db_password);//连接到数据库mysql_query("set names 'utf8'");//编码转化if(!$connection){ 阅读全文
posted @ 2012-05-07 14:31 ms.元 阅读(29795) 评论(0) 推荐(0)