词表 · 第 5 篇
PHP
1. syntax
- 译:语法 | PHP:变量
$、<?php ?>标签、heredoc/nowdoc 等构成的语言规范 - 短语:PHP syntax · heredoc syntax · alternative syntax
2. protocol
- 译:协议 | PHP:stream context 支持的访问协议(
file://、http://、php://等) - 短语:stream protocol ·
php://scheme · wrap a protocol
3. wrapper
- 译:包装器 | PHP:stream wrapper,把不同协议/资源抽象成统一的读写接口
- 例
- Register a custom stream wrapper. — 注册一个自定义 stream wrapper。
- The wrapper turns URLs into
fopen-able streams. — wrapper 把 URL 变成可fopen的流。
- 地道:stream wrapper(流包装器)
- 短语:stream wrapper · wrapper class · URL wrapper
4. binary
- 译:二进制;可执行文件 | PHP:CLI 入口的
php/php.exe二进制 - 短语:PHP binary · run the binary · 64-bit binary
5. composer
- 译:作曲家 | PHP:PHP 事实标准的依赖管理工具
- 例
- Install dependencies with
composer install. — 用composer install安装依赖。 composer requireadds a package. —composer require添加一个包。
- Install dependencies with
- 地道:composer.json manifest(composer.json 清单)
- 短语:composer install · composer require · composer.json
6. session
- 译:会话(Web:跨请求保存用户状态的机制)
- 短语:
$_SESSION· start a session · session_destroy
7. quote
- 译:引号(编程:用于字符串定界的
'或") - 短语:single quote · double quote · quote escaping
8. persistent
- 译:持久的 | PHP:persistent connection,worker 跨请求复用的 DB 连接
- 例
- Open a persistent connection with
PDO::ATTR_PERSISTENT. — 用PDO::ATTR_PERSISTENT打开持久连接。 - Persistent connections survive a single request. — 持久连接可跨单个请求复用。
- Open a persistent connection with
- 地道:persistent connection(持久连接)
- 短语:persistent connection · persist across requests · persistent session
9. garbage
- 译:垃圾(编程:不再被引用、待回收的内存/对象)
- 短语:garbage collection · GC cycle · free garbage
10. manipulate
- 译:操纵;处理 | PHP:对数组/字符串/图像等数据做变换
- 例
- Use
array_mapto manipulate every element. — 用array_map处理每个元素。 - GD lets you manipulate images programmatically. — GD 让你用代码处理图像。
- Use
- 地道:manipulate data(处理数据)
- 短语:manipulate strings · manipulate arrays · image manipulation
11. authentic
- 译:真实的;正宗的 | PHP:身份认证语境下指已通过验证的真实身份
- 例
- Verify the user is authentic before granting access. — 授权前先验证用户是真实身份。
- Authentic sessions rely on signed tokens. — 真实会话依赖签名 token。
- 地道:authentic user(已认证用户)
- 短语:authentic user · authentic token · authenticate
12. specific
- 译:特定的;具体的(编程:明确指定版本/类型/场景)
- 短语:PHP-specific · version-specific · case-sensitive
13. crypto
- 译:加密;密码学 | PHP:
openssl_*/sodium_*等扩展提供的加密函数集合 - 例
- Use libsodium for modern crypto. — 用 libsodium 做现代密码学。
- Hash passwords with
password_hash, not raw crypto. — 用password_hash哈希密码,别用底层 crypto。
- 地道:do crypto right(正确地做加密)
- 短语:crypto extension · openssl crypto · libsodium
14. generate
- 译:生成(编程:动态产生数据/输出)
- 短语:generate PDF · generate token · code generation
15. autoload
- 译:自动加载 | PHP:
spl_autoload_register+ PSR-4 按需 require 类文件 - 例
- Composer’s autoload loads classes on demand. — Composer 的 autoload 按需加载类。
- Register an autoload function with
spl_autoload_register. — 用spl_autoload_register注册 autoload 函数。
- 地道:PSR-4 autoload(PSR-4 自动加载)
- 短语:
spl_autoload_register· PSR-4 autoload ·vendor/autoload.php
16. namespace
- 译:命名空间 | PHP:用
namespace关键字给类/函数/常量划分的逻辑包 - 例
- Declare a namespace at the top of the file. — 在文件顶部声明 namespace。
- Use
useto import a namespace. — 用use导入一个 namespace。
- 地道:namespace alias(命名空间别名)
- 短语:namespace keyword ·
useimport · PSR-4 namespace
17. trait
- 译:特征;特质 | PHP:用
trait实现的水平复用机制,类可复用一组方法 - 例
- A trait lets classes reuse methods without inheritance. — trait 让类无需继承也能复用方法。
- Use a trait with the
usekeyword inside a class. — 在类里用use关键字使用 trait。
- 地道:horizontal reuse(水平复用)
- 短语:trait declaration · use a trait ·
insteadofconflict
18. mysqli
- 译:mysqli 扩展 | PHP:MySQL Improved 扩展,支持预处理语句与面向对象 API
- 例
- Use mysqli for prepared statements. — 用 mysqli 做预处理语句。
- mysqli supports both procedural and OOP styles. — mysqli 同时支持过程式和面向对象风格。
- 地道:mysql improved(MySQL 改进版)
- 短语:
mysqli_connect· prepared statement · OOP mysqli
19. PDO
- 译:PDO | PHP:PHP Data Objects,统一访问多种数据库的抽象层
- 例
- PDO gives a uniform DB API across drivers. — PDO 在不同驱动上提供统一的数据库 API。
- Always use PDO prepared statements. — 永远用 PDO 预处理语句。
- 地道:PDO prepared statement(PDO 预处理语句)
- 短语:PDO driver · PDOStatement · prepare and execute
20. opcode
- 译:操作码 | PHP:Zend 引擎把 PHP 编译后生成的中间字节码
- 例
- OPcache stores precompiled opcode. — OPcache 存储预编译的 opcode。
- The opcode is executed by the Zend VM. — opcode 由 Zend VM 执行。
- 地道:opcode cache(操作码缓存)
- 短语:OPcache · Zend opcode · opcode compilation
21. session cookie
- 译:会话 Cookie(Web:保存 session id 的 cookie,默认名
PHPSESSID) - 短语:
PHPSESSID· session cookie lifetime · cookie params
22. serialization
- 译:序列化 | PHP:
serialize/unserialize,把对象转成可存储、可传输的字符串 - 例
serializeturns an object into a string. —serialize把对象转成字符串。- Untrusted
unserializecan lead to RCE. — 不可信的unserialize可能导致远程代码执行。
- 地道:object serialization(对象序列化)
- 短语:
serialize/unserialize·__sleep/__wakeup· JSON serialization
23. templating
- 译:模板;模板引擎 | PHP:用模板(Twig / Blade / 原生 PHP)分离视图与逻辑
- 例
- Twig is the de-facto PHP templating engine. — Twig 是事实标准的 PHP 模板引擎。
- PHP itself started as a templating language. — PHP 本身就是从模板语言起步的。
- 地道:templating engine(模板引擎)
- 短语:Twig templating · Blade template · templating layer