我寄愁心与爪哇

如果能一步登天,
那别人的坚持又算什么呢?

0%

学习记录

个人学习记录

20220512

防止展开太长影响阅读,设置该选项卡。

20220511

防止展开太长影响阅读,设置该选项卡。

1
2
3
4
5
6
7
8
9
10
一、填空
1.实际的数据 元数据
2.0 n-1
3.3xn
4.transpose()
5.np.split(A,3,aixs=1) np.split(A,3,aixs=0)
二、判断
XXVXV
三、选择
CCD

20220510

防止展开太长影响阅读,设置该选项卡。

  • 选择

1~5 BADAD

6~10 AACCC

11 A

  • 填空

1.等价类方法、边界值法、决策表方法

2.输入、输出

3.测试不能充分进行

自动化测试复用性较低

4.有效等价类、无效等价类

5.黑盒

6.有效等价类、无效等价类

7.6n+1

8.冗余

9.1、2

10.因果、规格说明、决策表

  • sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
create database hcit_msg;
use hcit_msg;

create table comment(
id int unsigned not null primary key auto_increment,
date datetime not null,
poster varchar(20) not null,
comment text not null,
reply text not null,
mail varchar(60) not null,
ip varchar(15) not null
)default charset=utf8;

create table admin(
# unsigned无符号整数
id int unsigned not null primary key auto_increment,
username varchar(20) not null,
password varchar(32) not null,
salt CHAR(4) not null
)default charset=utf8;

20220509

防止展开太长影响阅读,设置该选项卡。

  • 课下

MySQL.php

1
2
3
4
5
<?php

class MySQL{

}

SQLite.php

1
2
3
4
5
<?php

class SQLite{

}

factory.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
header("Content-Type:text/html;charset=utf-8");
class DB{

public static function factory($type){
if (require_once($type . ".php")){
return new $type();
}else{
echo "Error!";
}
}
}

$mysql = DB::factory("MySQL");
$sqlite = DB::factory("SQLite");

var_dump($mysql);
echo "<br/>";
var_dump($sqlite);
  • 答疑讨论

index.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<form method="post">
<table class="table table-bordered">
<tr>
<th colspan="2" align="center">
<b>数据库连接类的应用</b>
</th>
</tr>
<tr>
<td>
服务器地址
</td>
<td>
<input type="text" name="host"/>
</td>
</tr>
<tr>
<td>
用户名
</td>
<td>
<input type="text" name="username"/>
</td>
</tr>
<tr>
<td>
密码
</td>
<td>
<input type="password" name="password"/>
</td>
</tr>
<tr>
<td>
数据库
</td>
<td>
<input type="text" name="dbname"/>
</td>
</tr>
<tr>
<td>
字符集
</td>
<td>
<input type="text" name="charset" value="utf8"/>
</td>
</tr>
<tr>
<td>
<input type="submit" name="submit" value="连接"/>
</td>
<td>
<input type="reset" value="重置">
</td>
</tr>
</table>
</form>
<?php
if (isset( $_POST["submit"])){
require "ConnDB.php";
$host = $_POST["host"];
$username = $_POST["username"];
$password = $_POST["password"];
$dbname = $_POST["dbname"];
$charset = $_POST["charset"];

$connDB = new ConnDB($host, $username, $password, $dbname,$charset);

echo !$connDB->getConnId() ? "数据库连接失败":"数据库连接成功";
}
?>
</body>
</html>

  • 样例

2022-05-09_130221


  • 数据表
1
2
3
4
5
6
7
create table student(
id int(4) primary key auto_increment,
name varchar(50) not null,
chinese varchar(20) not null,
english varchar(20) not null,
math varchar(20) not null
);
  • 启动
1
node app.js

20220506

防止展开太长影响阅读,设置该选项卡。

2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const mysql = require('mysql')

// 创建连接对象
const connection = mysql.createConnection({
host: 'localhost',
port: '3306',
user: 'root',
password: 'root',
database: 'nodedb'
})

// 建立连接
connection.connect(function (err){
if(err){
console.error('连接出错:' + err.stack)
return
}
console.log('连接成功,进程号为:' + connection.threadId)
})


insertSql = 'insert into data(name,class) values("wang","4")'
deleteSql = 'delete from data where class = 4'
updateSql = 'update data set name = "c" where name = "cao"'
selectSql = 'select * from data'
insertWithParamSql = 'insert into data(name,class) values(?,?)'
var param = ['cao','2']
sqlArray = [insertSql,deleteSql,updateSql,selectSql,insertWithParamSql]

sqlArray.forEach(sql => {
connection.query(sql,param,function(err,rows){
if (err){
console.error('错误:' + err)
}else{
console.log(rows)
}
})
})



connection.query(insertWithParamSql,param,function(err,rows){
if (err){
console.error('错误:' + err)
}else{
console.log(rows)
}
})


// 关闭连接
connection.end(function(err){
if (err){
console.log('关闭连接出错:' + err)
}
})
  • 截图

作业任务

三角

答疑讨论

圆形

答疑讨论-2

  • 代码

index.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta http-equiv="Content-Type" charset="text/html;UTF-8">
<title>图形计算器(面向对象)</title>
</head>
<body>
<h3>图形(面积&&周长)计算器</h3>
<a href="index.php?action=rect">矩形</a>
<a href="index.php?action=triangle">三角形</a>
<a href="index.php?action=circle">圆形</a>
<hr/>
<?php

// 自动加载类
spl_autoload_register(function ($class_name){
require_once strtolower($class_name) . ".class.php";
});


echo new Form("index.php");

echo "<br/><br/>";

if (isset($_POST["sub"])){
echo new Result();
}

?>
</body>
</html>

form.class.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
require "result.class.php";
class Form{
private $action;
private $shape;
function __construct($action = "") {
$this->action = $action;
$this->shape = isset($_REQUEST["action"]) ? $_REQUEST["action"] : "rect";
}

function __toString() {
$form = "<form action='".$this->action . "' method='post'> ";

switch ($this->shape){
case "rect":
$form .= $this->getRect();
break;
case "triangle":
$form .= $this->getTriangle();
break;
case "circle":
$form .= $this->getCircle();
break;
default:
$form .= "请选择一个形状";
}

$form .= "<input type='submit' name='sub' value='计算'/>";
$form .= "<form/>";
return $form;
}

private function getRect(){
$input = "<b>请输入 |矩形| 的长和宽:</b>"
. "<p>"
. "宽度:<input type='text' name='width' value='". $_POST['width'] ."'><br/>"
. "高度:<input type='text' name='height' value='". $_POST['height'] ."'><br/>"
. "<input type='hidden' name='action' value='rect'/>"
. "</p>";
return $input;
}
private function getTriangle(){
$input = "<b>请输入 |三角形| 的长和宽:</b>"
. "<p>"
. "第一边:<input type='text' name='side1' value='". $_POST['side1'] ."'><br/>"
. "第二边:<input type='text' name='side2' value='". $_POST['side2'] ."'><br/>"
. "第三边:<input type='text' name='side3' value='". $_POST['side3'] ."'><br/>"
. "<input type='hidden' name='action' value='triangle'/>"
. "</p>";
return $input;
}
private function getCircle(){
$input = "<b>请输入 |圆形| 的半径:</b>"
. "<p>"
. "半径:<input type='text' name='radius' value='". $_POST['radius'] ."'><br/>"
. "<input type='hidden' name='action' value='circle'/>"
. "</p>";
return $input;
}
}

result.class.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
class Result{
private $shape;
function __construct() {
switch ($_POST['action']){
case "rect":
$this->shape = new Rect();
break;
case "triangle":
$this->shape = new Triangle();
break;
case "circle":
$this->shape = new Circle();
break;
default :
$this->shape = false;
}
}

function __toString() {
if($this->shape){
$result = $this->shape->shapeName . "的周长" . $this->shape->perimeter() ."<br/>";
$result = $this->shape->shapeName . "的面积" . $this->shape->area() ."<br/>";
return $result;
}else{
return "没有这个形状";
}
}

}

shape.class.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php

abstract class Shape{
public $shapeName;
abstract function area();
abstract function perimeter();
/**
* 校验数值是否非负
*/
protected function validate($value,$message = "形状"){
if( $value == "" || !is_numeric($value) || $value < 0 ){
echo "<font color='red'>" . $message . "必须为非负数且不能为空</font><br/>";
return false;
} else {
return true;
}
}
}

triangle.class.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
class Triangle extends Shape{
private $side1 = 0;
private $side2 = 0;
private $side3 = 0;

function __construct() {
$this->shapeName = "三角形";

if ( $this->validate($_POST["side1"] , "三角形第一边")){
$this->side1= $_POST["side1"];
}
if ( $this->validate($_POST["side2"] , "三角形第二边")){
$this->side2= $_POST["side2"];
}
if ( $this->validate($_POST["side3"] , "三角形第三边")){
$this->side3= $_POST["side3"];
}

if ( !$this->validateSum()){
echo "<font color='red'>三角形两边之和必须大于第三边</font>";
exit;
}
}

public function area() {
$s = ($this->side1 + $this->side2 + $this->side3)/2;
return sqrt($s * ($s - $this->side1) * ($s - $this->side2) * ($s - $this->side3));
}

public function perimeter() {
return $this->side1 + $this->side2 + $this->side3;
}

private function validateSum(){
$condition1 = ($this->side1 + $this->side2) > $this->side3;
$condition2 = ($this->side2 + $this->side3) > $this->side1;
$condition3 = ($this->side1 + $this->side3) > $this->side2;

if( $condition1 && $condition2 && $condition3){
return true;
} else {
return false;
}
}
}

rect.class.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
class Rect extends Shape{
private $width = 0;
private $height = 0;

function __construct() {
$this->shapeName = "矩形";
if ( $this->validate($_POST["width"] , "矩形宽度") & $this->validate($_POST["height"] , "矩形高度")){
$this->width = $_POST["width"];
$this->height = $_POST["height"];
}else{
exit;
}
}


public function area() {
return $this->width * $this->height;
}

public function perimeter() {
return 2 * ($this->width + $this->height);
}

}

circle.class.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

class Circle extends Shape{
private $radius = 0;

function __construct() {
$this->shapeName = "圆形";

if ($this->validate($_POST["radius"] , "圆的半径")){
$this->radius = $_POST["radius"];
}else{
exit;
}
}

public function area() {
return pi() * $this->radius * $this->radius;
}

public function perimeter() {
return 2 * pi() * $this->radius;
}

}

单例模式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
class Db{
private static $_instance = null;
private $dbConn;

// 私有化构造器 & clone()
private function __construct() {
$this->dbConn = new MySQLi("localhost","root","","student");
$this->dbConn->query("set names utf8");
}
private function __clone() {

}

// 获取实例
public static function getInstance(){
if (self::$_instance == null){
self::$_instance = new self();
}
return self::$_instance;
}

public function select( $table ){
$result = $this->dbConn->query("select * from " . $table);
$result_arr = array();
while ($query = $result->fetch_assoc()){
$result_arr[] = $query;
}
return $result_arr;
}
}

$db = Db::getInstance();
$result = $db->select("student_info limit 0,2");
echo "<pre>";
print_r($result);

20220504

防止展开太长影响阅读,设置该选项卡。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>弹性盒布局</title>
<style>
.box{
min-height: 160px;
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: flex-end;
background-color: rgb(152, 152, 245);
border: 1px solid gray;
}
.A,.B,.C{
border: 1px solid red;
background-color: aqua;
}
.A{
order: 2;
flex: 0 1 auto;
align-self: center;
}
.B{
order: 1;
flex: 0 1 auto;
align-self: flex-start;
}
.C{
order: 3;
flex: 0 1 50px;
align-self: stretch;
}
</style>
</head>
<body>
<div class="box">
<div class="A">A</div>
<div class="B">B</div>
<div class="C">C</div>
</div>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
class Db{
private static $_instance = null;
private $dbConn;

// 私有化构造器 & clone()
private function __construct() {
$this->dbConn = new MySQLi("localhost","root","","student");
$this->dbConn->query("set names utf8");
}
private function __clone() {

}

// 获取实例
public static function getInstance(){
if (self::$_instance == null){
self::$_instance = new self();
}
return self::$_instance;
}

public function select( $table ){
$result = $this->dbConn->query("select * from " . $table);
$result_arr = array();
while ($query = $result->fetch_assoc()){
$result_arr[] = $query;
}
return $result_arr;
}
}

$db = Db::getInstance();
$result = $db->select("student_info limit 0,2");
echo "<pre>";
print_r($result);

20220503

防止展开太长影响阅读,设置该选项卡。

2

3

index.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta http-equiv="Content-Type" charset="text/html;UTF-8">
<title>图形计算器(面向对象)</title>
</head>
<body>
<h3>图形(面积&&周长)计算器</h3>
<a href="index.php?action=rect">矩形</a>
<a href="index.php?action=triangle">三角形</a>
<a href="index.php?action=circle">圆形</a>
<hr/>
<?php

// 自动加载类
sql_autoload_register(function ($class_name){
require_once strtolower($class_name) . ".class.php";
});


echo new Form("index.php");


if (isset($_POST["sub"])){
echo new Result();
}

?>
</body>
</html>

form.class.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
require "result.class.php";
class Form{
private $action;
private $shape;
function __construct($action = "") {
$this->action = $action;
$this->shape = isset($_REQUEST["action"]) ? $_REQUEST["action"] : "rect";
}

function __toString() {
$form = "<form action='".$this->action . "' method='post'> ";

switch ($this->shape){
case "rect":
$form .= $this->getRect();
break;
case "triangle":
$form .= $this->getTriangle();
break;
case "circle":
$form .= $this->getCircle();
break;
default:
$form .= "请选择一个形状";
}

$form .= "<input type='submit' name='sub' value='计算'/>";
$form .= "<form/>";
return $form;
}

private function getRect(){
$input = "<b>请输入 |矩形| 的长和宽:</b>"
. "<p>"
. "宽度:<input type='text' name='width' value='". $_POST['width'] ."'><br/>"
. "高度:<input type='text' name='height' value='". $_POST['height'] ."'><br/>"
. "<input type='hidden' name='action' value='rect'/>"
. "</p>";
return $input;
}
private function getTriangle(){
$input = "<b>请输入 |三角形| 的长和宽:</b>"
. "<p>"
. "第一边:<input type='text' name='side1' value='". $_POST['side1'] ."'><br/>"
. "第二边:<input type='text' name='side2' value='". $_POST['side2'] ."'><br/>"
. "第三边:<input type='text' name='side3' value='". $_POST['side3'] ."'><br/>"
. "<input type='hidden' name='action' value='rect'/>"
. "</p>";
return $input;
}
private function getCircle(){
$input = "<b>请输入 |圆形| 的半径:</b>"
. "<p>"
. "半径:<input type='text' name='redius' value='". $_POST['redius'] ."'><br/>"
. "<input type='hidden' name='action' value='circle'/>"
. "</p>";
return $input;
}
}

result.class.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
class Result{
private $shape;
function __construct() {
switch ($_POST['action']){
case "rect":
$this->shape = new Rect();
break;
case "triangle":
$this->shape = new Triangle();
break;
case "circle":
$this->shape = new Circle();
break;
default :
$this->shape = false;
}
}

function __toString() {
if($this->shape){
$result = $this->shape->shapeName . "的周长" . $this->shape->perimeter() ."<br/>";
$result = $this->shape->shapeName . "的面积" . $this->shape->area() ."<br/>";
return $result;
}else{
return "没有这个形状";
}
}

}

20220502

防止展开太长影响阅读,设置该选项卡。

4.5

4.6

4.5代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
header("Content-Type:text/html;charset=utf-8");

abstract class Animal{
abstract public function shout();
}

class Dog extends Animal{

public function shout() {
echo "汪汪~~<br/>";
}

}
class Cat extends Animal{

public function shout() {
echo "喵喵~~<br/>";
}

}

$dog = new Dog();
$dog->shout();
$cat = new Cat();
$cat->shout();

4.6代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
header("Content-Type:text/html;charset=utf-8");

interface Animal{
function run();
function shout();
}

class Dog implements Animal{

public function run() {
echo "小狗在奔跑<br/>";
}

public function shout() {
echo "汪汪~~<br/>";
}

}

class Cat implements Animal{

public function run() {
echo "小猫在奔跑<br/>";
}

public function shout() {
echo "喵喵~~<br/>";
}

}

$dog = new Dog();
$dog->run();
$dog->shout();

$cat = new Cat();
$cat->run();
$cat->shout();

答疑讨论

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
header("Content-Type:text/html;charset=utf-8");

abstract class Animal{
abstract public function shout();
}

class Dog extends Animal{

public function shout() {
echo "汪汪~~<br/>";
}

}
class Cat extends Animal{

public function shout() {
echo "喵喵~~<br/>";
}

}

function animalShout($obj){
if ($obj instanceof Animal){
$obj->shout();
} else {
echo "Error:对象错误!";
}
}

$dog = new Dog();
$dog->shout();
$cat = new Cat();
$cat->shout();
echo "---------<br/>";
echo "---------<br/>";
animalShout($dog);
animalShout($crow);
6-16 6-17

20220429

防止展开太长影响阅读,设置该选项卡。

2022-04-29_184125

4.4.3 and 4.4.4

4-4-3 4-4-4

4.4.3

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
class Animal{
private static $firstCry = 0;
private $lastCry;
public function __construct() {
$this->lastCry =++self::$firstCry;
}

public function printLastCry(){
echo var_dump($this->lastCry);
}
}

$bird = new Animal();
$bird->printLastCry();

4.4.4

1
2
3
4
5
6
7
8
9
10
11
12
13
<?php

class MyClass{
const constant = "我是一个常量";
function showConstant(){
echo self::constant . "<br/>";
}

}

echo MyClass::constant . "<br/>";
$class = new MyClass();
$class->showConstant();

20220426

防止展开太长影响阅读,设置该选项卡。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
header("Content-type:text/html;charset=utf-8");
class Animal{
private $name = "";
private $color = "";
private $age = "";

public function __get($property) {
echo "get方法被调用,$property<br/>";
if(isset($this->$property)){
return $this->$property;
}else{
return null;
}
}

public function __set($property,$value){
echo "__set方法被调用,$property=$value<br/>";
$this->$property = $value;
}

public function __isset($property) {
echo "__isset()方法调用,$property<br/>";
return isset($this->$property);
}
public function __unset($property) {
echo "__unset()方法调用,$property<br/>";
unset($this->$property);
}
}
$pig = new Animal();
echo $pig->name;
$pig->name = "猪";

isset($pig->name);
echo var_dump(isset($pig->color)) . "<br/>";
isset($pig->age);

unset($pig->name);
unset($pig->color);
unset($pig->age);

20220425

防止展开太长影响阅读,设置该选项卡。

2022-04-25_090856
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
class Animal{
public $name = "";
public $color = "";
public $age = "";

public function __construct($name,$color,$age) {
$this->name = $name;
$this->color = $color;
$this->age = $age;
}

public function getInfo(){
echo "动物的名字:" . $this->name . "<br/>";
echo "动物的颜色:" . $this->color . "<br/>";
echo "动物的年龄:" . $this->age . "<br/>";
}
}

class Bird extends Animal{
public $wing = "";
public function __construct($name,$color,$age,$swing){
parent::__construct($name, $color, $age);
$this->wing = $swing;
}

public function getInfo(){
parent::getInfo();
echo "翅膀:".$this->wing . "<br/>";
}
public function fly(){
echo "I can fly!<br/>";
}

}

$crow = new Bird("乌鸦","黑色","3","1");
$crow->getInfo();
$crow->fly();
2022-04-25_155257

6-8.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var net = require('net');

var server = net.createServer(function (socket) {
var address = server.address();
var message = 'client, the server address is ' + JSON.stringify(address);
socket.write(message, function () {
var writeSize = socket.bytesWritten;
console.log(message + 'has send');
console.log('the size of message is ' + writeSize);
});
socket.on('data', function (data) {
console.log(data.toString());
var readSize = socket.bytesRead;
console.log('the size of data is ' + readSize);
});
});

server.listen(18001, function () {
console.log('server is listening');
});

6-12.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var net = require('net')

var client = net.Socket();
// 连接服务器
client.connect(18001,'127.0.0.1',function(){
console.log('Connect the server.')
// 发送数据
client.write('Message from client.')
})
// 监听服务器数据
client.on('data',function (data){
console.log('The data of server is ' + data.toString())
})

client.on('end',function(){
console.log('data end')
})

20220422

防止展开太长影响阅读,设置该选项卡。

2022-04-22_094507 2022-04-22_094635 2022-04-22_094737 2022-04-22_094836 2022-04-22_094951

2022-04-22_134744

2022-04-22_134824

2022-04-22_135420

IMG_20220422_143857

2022-04-22_152842

20220420

防止展开太长影响阅读,设置该选项卡。

计算景pandas无水印区游客总量-numpy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import numpy as np

# np.loadtxt()
# 0:读取文件路径
# skiprows:忽略行数
# dtype:读取后转换的类型
# delimiter:指定分隔符
# usecols:指定读取列
# unpack:读取多列设置"True"
(jzg_data,zjj_data,xg_data,dbhq_data,dsn_data) = np.loadtxt("D:\\workspace\\source\\tourist_data.csv",
skiprows=1,
dtype="int",
delimiter=",",
usecols=(1,2,3,4,5),
unpack="True")
# print(jzg_data)
# 求和
jzg_total = jzg_data.sum()
zjj_total = zjj_data.sum()
xg_total = xg_data.sum()
dbhq_total = dbhq_data.sum()
dsn_total = dsn_data.sum()
print("(numpy)这段时间到九寨沟的游客总量为:",jzg_total)
print("(numpy)这段时间到张家界的游客总量为:",zjj_total)
print("(numpy)这段时间到香港的游客总量为:",xg_total)
print("(numpy)这段时间到东部华侨城的游客总量为:",dbhq_total)
print("(numpy)这段时间到上海迪士尼的游客总量为:",dsn_total)

计算景区游客总量-pandas

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import pandas as pd
# 0:读取文件路径
# index_col:索引列
# header:标题所在索引
# encoding:存储编码
data = pd.read_csv("D:\\workspace\\source\\tourist_data.csv",
index_col=u"日期",
header=0,
encoding="gb2312")
# type()返回数据类型
# print(type(data))# DataFrame
# print(data)

jzg_total = data["九寨沟"].sum()
zjj_total = data["张家界"].sum()
xg_total = data["香港"].sum()
dbhq_total = data["东部华侨城"].sum()
dsn_total = data["上海迪士尼"].sum()

print("(pandas)这段时间到九寨沟的游客总量为:",jzg_total)
print("(pandas)这段时间到张家界的游客总量为:",zjj_total)
print("(pandas)这段时间到香港的游客总量为:",xg_total)
print("(pandas)这段时间到东部华侨城的游客总量为:",dbhq_total)
print("(pandas)这段时间到上海迪士尼的游客总量为:",dsn_total)

20220419

防止展开太长影响阅读,设置该选项卡。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
图书管理系统设计
一、创建数据库和表,存入数据
二、实现PHP页面操作数据库
0.conn.php
1.数据分页
index.php
2.数据编辑
update.php,update_ok.php
3.删除
单行删除 delete.php
批量删除 delete_lot.php
4.数据添加
insert.php
三、样式表

2022-04-19_171922

2022-04-19_171949

2022-04-19_172714

20220418

防止展开太长影响阅读,设置该选项卡。

读xml纯文本写入文件

2022-04-18_090947

  • 本文主题: 学习记录
  • 本文作者: 我寄愁心与爪哇
  • 本文链接: https://cysheng.gitee.io/9900f79e.html
  • 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!

欢迎关注我的其它发布渠道