Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5b7901a

Browse files
authored
Update Rocket.md
1 parent 431fd16 commit 5b7901a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

‎Rocket.md‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,20 @@ MySQL为了保证ACID中的一致性和持久性,使用了WAL(Write-Ahead Logg
255255
3. 减少交互次数(批量提交)
256256
4. 设置合理的Fetch Size(数据每次返回给客户端的条数)
257257

258+
### PHP防止SQL注入
259+
260+
1.过滤关键字
261+
2.利用Mysqli和PDO
262+
PDO命名参数以及参数绑定:
263+
$params = array(':username' => 'test', ':email' => $mail, ':last_login' => time());
264+
$pdo->prepare('SELECT * FROM user WHERE username = :username AND email = :emailAND last_login > :last_login');
265+
$pdo->execute($params);
266+
267+
MySQLi的参数绑定:
268+
$query = $mysqli->prepare('SELECT * FROM users WHERE username = ? AND email = ? AND last_login > ?');
269+
$query->bind_param('sss', 'test', $mail, time() - 3600);
270+
$query->execute();
271+
258272
## JVM
259273

260274
### 运行时数据区域
@@ -996,4 +1010,4 @@ select quantity from products WHERE id=3 for update;
9961010
```
9971011
quantity = select quantity from products WHERE id=3;
9981012
update products set quantity = ($quantity-1) WHERE id=3 and queantity = $quantity;
999-
```
1013+
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /