
php
虾米大王
努力学习
展开
-
jquery <table>通过button.Click获取选中行的td值
js文件//table选中行,取pkid值function ReturnSelectRowPK(tableClass, rowClass, pkIndex) { var pkid = $(tableClass).find("tr[class="+rowClass+"]") .find("td").eq(pkIndex).text(); if(pkid == "") { return -1; } return pkid;}原创 2021-03-25 17:47:52 · 1097 阅读 · 0 评论 -
php教程--案例38(文章管理系统)
这个演示项目,我把文件夹目录建立的简单,没有分层级,都是同级目录。根目录cms_1。根目录 一级目录 二级目录 cms_1 lib ueditor article_add.php article_del.php article_edit.php article_show.php category.php ...原创 2020-09-07 21:52:27 · 1696 阅读 · 0 评论 -
php教程--案例37(PDO错误处理机制)
<?php//case 37 PDO错误处理机制/** * 建表sql语句 *create table emp_books(book_id int unsigned auto_increment primary key,book_name varchar(20) not null comment '书名',book_author varchar(15) comment '作者',pub_time varchar(10) comment '出版日期')charset = utf8;.原创 2020-09-02 16:41:06 · 262 阅读 · 1 评论 -
php教程--案例36(预处理语句)
<?php//case 36 预处理语句/** * 建表sql语句 *create table emp_books(book_id int unsigned auto_increment primary key,book_name varchar(20) not null comment '书名',book_author varchar(15) comment '作者',pub_time varchar(10) comment '出版日期')charset = utf8; * .原创 2020-09-02 16:08:54 · 265 阅读 · 0 评论 -
php教程--案例35(PDO基本使用)
<?php//case 35 PDO基本使用/** * 建表sql语句 *create table emp_books(book_id int unsigned auto_increment primary key,book_name varchar(20) not null comment '书名',book_author varchar(15) comment '作者',pub_time varchar(10) comment '出版日期')charset = utf8;.原创 2020-09-02 15:16:25 · 588 阅读 · 0 评论 -
php教程--案例34(抽象类)
<?php//case 34 抽象类/** * Class goods1 * */abstract class goods1{ public $name; public $price; /** * goods1 constructor. * @param $name * @param $price */ public function __construct($name,$price) { .原创 2020-09-02 11:20:04 · 310 阅读 · 0 评论 -
php教程--案例33(模型类)
这个代码有点多,比较复杂;先在工程项目里,添加一个文件夹(library_1),然后将下面的代码都建立在这个文件夹中统一管理。首页 index.php<?php//case 33 模型类//引用自动加载页require_once './init.php';//调用model方法$stu = model('emp_info');//查询$data = $stu->field('emp_name,emp_dept')->select();echo "<pre原创 2020-09-02 10:17:20 · 452 阅读 · 0 评论 -
php教程--案例32(类库自动加载)
t223.php<?php//case 32 类库自动加载header('content-type:text/html;charset=utf-8');function my_autoload($className){ require_once "./$className.php";}spl_autoload_register("my_autoload");t224.php<?phpclass t224{ public function原创 2020-09-01 15:35:56 · 203 阅读 · 0 评论 -
php教程--案例31(数据库操作类)
<?php//case 31 数据库操作类//类class mysqldb{ //私有 配置数组 private $db_config = array( 'host'=>'localhost', 'port'=>'3306', 'user'=>'root', 'pwd'=>'mysql123', 'charset'=>'utf8', 'dbname'=.原创 2020-09-01 11:37:31 · 362 阅读 · 0 评论 -
php教程--案例30(静态工具类)
t220.php<?php//case 30 静态工具类class tool1{ /** * @param $info * @param $url */ public static function alertGo($info,$url) { echo "<script>alert('$info');location.href='$url';</script>"; exit();原创 2020-08-31 17:02:01 · 273 阅读 · 0 评论 -
php教程--案例29(文件上传类)
t218.php<?php//case 29 文件上传类//上传类class upload{ //私有,文件类型数组 private $allow_types = array('image/jpeg','image/pjpeg','image/png','image/x-png','image/gif'); //文件尺寸 private $max_size = 1048576; //图片目录 private $upload_path = '原创 2020-08-31 16:02:33 · 323 阅读 · 0 评论 -
php教程--案例28(体验类与对象)
<?php//case 28 体验类与对象//声明类class student1{ public $name; public $student_id; public $age; public $gender; public function introduce() { echo "大家好,我是{$this->name},今年{$this->age}岁。<br>我的学号是{$this->studen.原创 2020-08-31 09:51:11 · 322 阅读 · 0 评论 -
php教程--案例26(文件管理器)
<?php//case 26 文件管理器//设置配置文件中,只能访问本目录ini_set('open_basedir',__DIR__);//路径$path = isset($_GET['path'])?$_GET['path']:'.';//文件名$file = '';//判断,如果是文件类型if(is_file($path)){ //获得文件名 $file = basename($path); //获得路径 $path = dirname($p.原创 2020-08-30 22:03:58 · 434 阅读 · 0 评论 -
php教程--案例25-2(验证码生成与验证(线条))
t214.php<html><head> <title>验证码生成与验证</title> <script type="text/javascript"> function change1() { var change = document.getElementById("change"); var img = document.getElementById("c原创 2020-08-29 22:05:23 · 381 阅读 · 0 评论 -
php教程--案例25(验证码生成与验证)
t212.php<html><head> <title>验证码生成与验证</title></head><body><form action="./t212.php" method="post"> <p>用户名:<input type="text" name="user_name" value=""></p> <p>密码:<input原创 2020-08-29 21:28:52 · 702 阅读 · 0 评论 -
php教程--案例23(生成缩略图)
<?php//case 23 生成缩略图$info = array('id'=>234,'name'=>'王五');?><html><head> <title>用户头像上传</title></head><body><form action="" method="post" enctype="multipart/form-data"> <h2>编辑用户头.原创 2020-08-29 14:46:28 · 479 阅读 · 0 评论 -
php教程--案例22(用户头像上传)
<?php//case 22 用户头像上传$info = array('id'=>234,'name'=>'王五');?><html><head> <title>用户头像上传</title></head><body><form action="" method="post" enctype="multipart/form-data"> <h2>编辑用户.原创 2020-08-28 21:53:21 · 1570 阅读 · 0 评论 -
php教程--案例20(用户登录)
<?php//case 20 用户登录/** * * * * * */?><html><head> <title>用户登录</title></head><body><form method="post" action="./t209.php"> <sapn> 用户名:<input type="text" name="user_name.原创 2020-08-28 15:52:19 · 755 阅读 · 0 评论 -
php教程--案例19(保存浏览历史)
<?php//case 19 保存浏览历史//虚拟新闻数组$all_data = array( 1=>array('学习php','月薪万元不是梦','......'), 2=>array('学习java','日薪万元不是梦','......'), 3=>array('我是程序员','成为高富帅,迎娶白富美','......'), 4=>array('学习编程的终极奥义','秃头秃头再秃头','.....'));//获取新闻id$i.原创 2020-08-28 11:02:45 · 465 阅读 · 0 评论 -
php教程--案例17(用户信息编辑)
<?php//case 17 用户信息编辑/* * 建表SQL语句create table emp_userinfo( id int unsigned auto_increment primary key, --主键 nick_name varchar(10) not null, --昵称 gender enum('男性','女性','中性') not null, --性别 email varchar(40) not null, -- 邮箱 q.原创 2020-08-27 21:56:28 · 1247 阅读 · 1 评论 -
php教程-案例16(用户注册)
<?php//case 16 用户注册/* * 建表SQL语句 * *create table emp_user( id int unsigned auto_increment primary key, user_name varchar(10) not null unique, password char(32) not null, email varchar(40) not null)charset=utf8; * * * */?>.原创 2020-08-26 17:27:16 · 830 阅读 · 0 评论 -
php教程--案例15-2(修改信息)
t204.php<?php//case 15-2 修改信息/* *建立数据表的sql语句 * * create table emp_info( emp_id int unsigned auto_increment primary key, emp_name varchar(20) not null, emp_dept varchar(20) not null, date_birth timestamp not null, date_entry原创 2020-08-26 10:28:46 · 784 阅读 · 0 评论 -
php教程--案例15-1(添加信息)
t202.php<?php//case 15-1 添加信息/* *建立数据表的sql语句 * * create table emp_info( emp_id int unsigned auto_increment primary key, emp_name varchar(20) not null, emp_dept varchar(20) not null, date_birth timestamp not null, date_entry原创 2020-08-25 15:56:01 · 837 阅读 · 0 评论 -
php教程--案例14(分页显示信息)
<?php//case 14 分页显示信息/* *建立数据表的sql语句 * * create table emp_info( emp_id int unsigned auto_increment primary key, emp_name varchar(20) not null, emp_dept varchar(20) not null, date_birth timestamp not null, date_entry timestamp .原创 2020-08-24 16:52:13 · 906 阅读 · 0 评论 -
php教程--案例13(员工信息搜索)
<?php//case 13 员工信息搜索/* *建立数据表的sql语句 * * create table emp_info( emp_id int unsigned auto_increment primary key, emp_name varchar(20) not null, emp_dept varchar(20) not null, date_birth timestamp not null, date_entry timestamp .原创 2020-08-24 15:37:36 · 1277 阅读 · 0 评论 -
php教程--案例12(员工信息排序)
<?php//case 12 员工信息排序/* *建立数据表的sql语句 * * create table emp_info( emp_id int unsigned auto_increment primary key, emp_name varchar(20) not null, emp_dept varchar(20) not null, date_birth timestamp not null, date_entry timestamp n.原创 2020-08-24 15:11:45 · 1400 阅读 · 0 评论 -
php教程--案例11(显示员工信息)
<?php//case 11 显示员工信息/* *建立数据表的sql语句 * * create table emp_info( emp_id int unsigned auto_increment primary key, emp_name varchar(20) not null, emp_dept varchar(20) not null, date_birth timestamp not null, date_entry timestamp .原创 2020-08-24 10:54:51 · 1103 阅读 · 0 评论 -
php教程--案例10(网页布局)
t195.php<?php//case 10 网页布局//定义常量,防止直接访问引入页面define('WEBTEST','test1');?><html><head> <meta charset="UTF-8"> <title>网页布局</title> //样式表 <style type="text/css" rel="stylesheet"> .title原创 2020-08-23 22:35:24 · 2324 阅读 · 0 评论 -
php教程--案例9(随机双色球)
<?php//case 9 双色球echo "<h2>随机双色球</h2>";echo "<form method='get' action=''>";echo "<input type='submit' name='rand' id='rand' value='机选一注'>";echo "</form>";echo "<hr>";if(isset($_GET['rand'])){ //红球,生成数组.原创 2020-08-23 21:25:02 · 3456 阅读 · 2 评论 -
php教程--案例8(显示订单信息)
<?php//case 8 显示订单信息header("Content-type:text/html;charset=utf-8");//多维数组$goods = array( array('name'=>'主板','price'=>'779','producing'=>'广东','num'=>4), array('name'=>'显卡','price'=>'1299','producing'=>'深圳','num'=>2),.原创 2020-08-23 20:36:52 · 1472 阅读 · 0 评论 -
php教程--案例7(获取文件后缀)
<?php//case 7 获取文件后缀header('Content-type:text/html;charset=utf-8');//文件路径$path = '';//提交,获得文件名称if(isset($_POST['up_file1'])){ $path = $_FILES['file1']['name'];}//调用函数,获取后缀$ext = getFileExt($path);echo "<h2>获取文件后缀</h2>";ech.原创 2020-08-23 12:05:25 · 749 阅读 · 0 评论 -
php教程--案例6(九九乘法表)
<?php//case 6 九九乘法表header('Content-type:text/html;charset=utf-8');echo "<h2>九九乘法表</h2>";echo "<table border='1' cellpadding='0' cellspacing='0'>";//总循环for ($i=1; $i<=9; $i++){ echo "<tr>"; // for ($j=1; $.原创 2020-08-23 11:26:28 · 309 阅读 · 0 评论 -
php教程--案例5(金字塔)
<?php//case 5 打印金字塔//当前行$line = 1;//空格数$empty = 1;//星数$star = 1;//塔总行数$total_line = 30;echo "<table>";//总循环while($line <= $total_line){ //空格数计算 $empty = $total_line - $line; //星数计算 $star = 2 * $line - 1; //空格当.原创 2020-08-23 11:02:06 · 1252 阅读 · 0 评论 -
php教程--案例4(判断闰年)
<?phpheader("Content-type:text/html;charset=utf-8");echo "<h2>闰年的判断</h2>";$year = 0;//Get方式获取数据if(isset($_GET['ok'])){ $year = (int)$_GET['years'];}//判断条件,方式一if (($year % 4 == 0) && ($year % 100 != 0) || ($year % 400 .原创 2020-08-23 10:28:41 · 1241 阅读 · 0 评论 -
php教程--案例3
<?phpheader("Content-type:text/html;charset=utf-8");//定义变量$name = '小明';$score = 0;$str = '';//点击提交按钮,随机成绩和姓名if($_POST['rand_score']){ //姓名数组 $array_name = array( '0'=>'小明','1'=>'小红','2'=>'小熊','3'=>'小娜','4'=>'小蛋','5'=>.原创 2020-08-22 23:20:16 · 293 阅读 · 0 评论 -
php教程--案例2
<?php//字符集header('Content-type:text/html;charset=utf-8');//定义常量,两种方式const DISCOUNT = 0.9;//define("DISCOUNT",0.9);//商品名称$fruit_banana = "香蕉";$fruit_apple = "苹果";$fruit_orange = "桔子";//购买数量$weight_banana = 2;$weight_apple = 1;$weight_orange.原创 2020-08-22 22:39:43 · 326 阅读 · 0 评论 -
php教程--案例1
<html><head> <meta charset="UTF-8"> <title>服务器信息</title></head><body> <table> <tr> <th colspan="2">服务器信息展示</th> </tr> <tr> .原创 2020-08-22 21:59:15 · 269 阅读 · 1 评论 -
php--模拟调用接口的代码
t182.php模拟接口的代码<?phperror_reporting(0);/** * * *///显示function show($id=0){ //实例化pdo $pdo = new PDO('mysql:dbname=test;host=localhost','root','mysql123'); //查询语句,:id表示绑定 $sql = "select * from user where user_id=:id"; //设原创 2020-08-21 15:10:16 · 416 阅读 · 0 评论 -
php--模拟接口的代码
返回xml的方式<?php/** * * *///显示function show($id){ //连接数据库 $pdo = new PDO('mysql:dbname=test;host=localhost','root','mysql123'); $sql = "select * from user where user_id=:id"; $pdo->query("set names utf8"); $result = $原创 2020-08-21 14:53:42 · 225 阅读 · 0 评论 -
php--模拟接口方式的代码练习
<?php/** * * *///返回数据函数function show($id){ //pdo连接 $pdo = new PDO('mysql:dbname=test;host=localhost','root','mysql123'); //查询语句,:id表示绑定字段 $sql = "select * from user where user_id=:id"; //设定字符集 $pdo->query("set names u.原创 2020-08-20 16:20:22 · 274 阅读 · 0 评论