cuốn sách gpt4 ai đã làm

php - MySQL 括号?

In lại Tác giả: Hồ Xil 更新时间:2023-11-01 07:47:05 29 4
mua khóa gpt4 Nike

最近我看到了很多将 SQL 值包含在 {} 中的 PHP/MySQL 问题,例如:

SELECT * FROM table WHERE field LIKE '{$value}';

这是怎么回事?它甚至有效吗?为什么这么多人使用这种奇怪的(至少对我而言)语法?

câu trả lời hay nhất

từ php.net :

Complex (curly) syntax

This isn't called complex because the syntax is complex, but because it allows for the use of complex expressions.

In fact, any value in the namespace can be included in a string with this syntax. Simply write the expression the same way as it would appear outside the string, and then wrap it in { and }. Since { can not be escaped, this syntax will only be recognised when the $ immediately follows the {. Use {\$ to get a literal {$.

关于php - MySQL 括号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2168160/

29 4 0
Hồ Xil
Hồ sơ

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá taxi Didi miễn phí
Phiếu giảm giá taxi Didi
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress