1 . PHP 指的是?(C )A.Private Home PageB.Personal Hypertext ProcessorC.PHP: Hypertext PreprocessorD.Personal Home Page2 . PHP 服务器脚本由哪个分隔符包围?CA.<?php>...</?>B.<script>...</script>C.<?php…?>D.<&>...</&>3 . 如何使用 PHP 输出"hello world"?A."Hello World";B.echo "Hello World";C.Document.Write("Hello World");4 . 在 PHP 中,所有的变量以哪个符号开头?A.! B.& C.$5 . 结束 PHP 语...
<?php
header("content-type:text/html;charset=utf-8");
/**
1,ord()返回字符串第一个字符的ASCII值
2,strcasecmp()不区分大小写比较两个字符串
3,strcmp()区分大小写比较两字符串
4,strncmp()区分大小写比较字符串前n个字符
5,strncasecmp()不区分大小写比较字符串的前n个字符
6,strnatcmp() strnatcasecmp 区分大小写、不区分大小写按自然顺序比较字符串长度
7,chunk_split() 将字符串分割成小块
8,strtok() 切开字符串...
练习内容:随机生成一个字符串代码:<?phpclass randstring{ private $length; private $type; private $one = array(0,1,2,3,4,5,6,7,8,9); private $two = array(0,1,2,3,4,5,6,7,8,9,‘a‘,‘b‘,‘c‘,‘d‘,‘e‘,‘f‘,‘g‘,‘h‘,‘i‘,‘j‘,‘k‘,‘l‘,‘m‘,‘n‘,‘o‘,‘p‘,‘q‘,‘r‘,‘s‘,‘t‘,‘u‘,‘v‘,‘w‘,‘x‘,‘y‘,‘z‘); private $three = array(‘a‘,‘b‘,‘c‘,‘d‘,‘e‘,‘f‘,‘g‘,‘h‘...
$sql = "select * from goods order by price desc limit 0,3";去前面三条$sql = "select * from goods order by price desc limit 3,3";去前面三条$sql = "select * from goods order by price desc limit 6,3";去前面三条$sql = "select * from goods order by price desc limit 9,3";去前面三条(n-1)*3就是他的规律.分页原理就迎刃而解了 //倒序排列 显示3条 可以用来做分页,下面讲讲他的原理: 原文:https://www.cnblogs.com/x...
框架的作用:功能:操作数据库 模版引擎smarty分析,应该具备什么功能?a:具体配置文件 ,配置文件的读取功能
b:数据库处理类
c:目录结构先建一个includes文件放入,配置文件(config.php),配置类(conf.class.php),mysql数据库处理类(mysql.class.php),网站初始化文件(init.php)config.php 文件: //网站的配置文件$_cfg=array();$_cfg[‘host‘]=‘localhost‘;
$_cfg[‘user‘]=‘root‘;
$_cfg[‘pwd‘]=‘root‘;
$_cfg[‘d...
题目::创建若干个输入文本框,当光标离开文本框的时候如果文本框为空,则将文本框背景色设置为红色,如果不为空则为白色。 1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2<html xmlns="http://www.w3.org/1999/xhtml"> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 5<title>无标题文档</title> 6<!--创建若...
php练习-javascript,JQuey制作页面切换一.重点:css样式,js的dom取值,js的事件
JQuey引入地址<script type="text/javascript" src="<a href="https://cdn.bootcss.com/jquery/2.2.4/jquery.js"></script>" rel="nofollow">https://cdn.bootcss.com/jquery/2.2.4/jquery.js"></script>二.js原生代码<!DOCTYPE html><html><head lang="en"><meta charset="UTF-8"><title>实践题 - 选项卡</title><style type="text/css">/ CSS样...
<?phpfunction bubble_sort(& $arr){
$number=count($arr);
for($i=0;$i<$number-1;$i++){
for($j=0;$j<$number-1-$i;$j++){if($arr[$j]>$arr[$j+1]){$tmp=$arr[$j];$arr[$j]=$arr[$j+1];$arr[$j+1]=$tmp;}
}
}
}$str="10 2 36 14 10 25 23 85 99 45";
$arr=explode(" ",$str);
bubble_sort($arr);
echo "<pre>";
var_dump($arr);?><!--
输出结果
array(10) {[0]=>string(1) "2"[1]=>string(2) "10"[2]=>string(2) "10"[3]=>string...
练习题目:解题:方法一:1. 投票主页面:投票#list
{width:400px;height:300px;}
#jieguo
{width:400px;height:300px;}
.x
{float:left;}2. 处理投票页面:Query($sql,1);//1代表$sql的类型
}
header ("location:TouPiao.php");
?>3. 查看投票结果页面:查看结果.x
{float:left;}query($sql);
$tmmc=$arr[0][1];
echo "{$tmmc}:";
//从调研选项表中输出选项内容:
$sqlxx="select * from diaoyanxuanxiang where timudaihao='{$ar...
这篇文章主要介绍了关于PHP练习之实现分页,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下创建表语句CREATE TABLE `guestbook` (`id` mediumint(8) unsigned NOT NULL auto_increment, `nickname` char(15) NOT NULL default , `email` varchar(100) NOT NULL default , `content` text NOT NULL, `createtime` int(10) unsigned NOT NULL default 0,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSE...
刚刚学完php面向对象的编程,参考着高洛峰老师的php教程学习了这个实例。效果图片:以下是实现代码:index.php<html><head><title>图形计算(使用面向对象开发技术)</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><center><h1>图形(周长&面积) 计算器</h1><a href="index.php?action=rect">矩形</a><a href="index.php?action=triangle">三角形</a><a href="index.php?action=cir...
既然是数据库练习,你先的建立一个数据库吧,我们来搞一个出来:1、进入phpmyadmin,新建数据库:2、新建数据表:3、新建字段:(collation选择utf8_bin)4、勾选A_I,让id自增:5、保存:6、尝试插入数据:7、随便写点信息,点击执行:8、点击浏览,看一下效果:9、插入成功,说明我们表没有问题,id也是自增的:下面是源码:<?php/*** 数据库练习* http://www.gxlcms.com/** mysql_connect — 打开一个到 MySQL 服务器的连接* my...
转载请注明出处:http://www.gxlcms.com/觉得博文有用,请点赞,请评论,请关注,谢谢!~其实比起来whlie来说,更喜欢用for,这里一起练习了table表单。看一下GIF动态效果图,顺便看一下代码:没有新的知识点,所以代码中没有注释,新手朋友那里不懂问哪里吧,让我们起学习php~~<?php$i = 0;while (true){echo "{$i}<br>";$i++;if ($i > 10){break;}}/** ***********************分割线************************* */echo "<table b...
主要是在登录和退出的时候,设置cookies。来保存登录和安全退出1:在登录页面设置//设置cookies的值 _setcookies($_rows[tg_username], $_rows[tg_uniqid],$_clean[time]); _location(null,index.php);第二步:生成cookie,/*** _setcookies* @param unknown $_username* @param unknown $_uniqid*/function _setcookies($_username,$_uniqid,$_time){setcookie(username,$_username);setcookie(uniqid,$_uniqid);switch ($_time) ...
index_uploadsindex_uploads.php
<?phpheader("content-type:text/html;charset=utf-8");echo "";print_r($_FILES);echo "";$count = count($_FILES[file][name]);for ($i = 0; $i < $count; $i++) {$tmpfile = $_FILES[file][tmp_name][$i];$filefix = array_pop(explode(".", $_FILES[file][name][$i]));$dstfile = "uploads/files/".time()."_".mt_rand().".".$filefix;if (move_uploaded_file($tmpfile, $dstfile)) {echo "";}...