php / doc-zh Goto Github PK
View Code? Open in Web Editor NEWChinese translation of the PHP documentation
Chinese translation of the PHP documentation
From manual page: https://php.net/language.oop5.visibility
---属性的访问控制
MyClass2类继承MyClass时,在MyClass2类中修改public和protected属性,对应属性会发生变化,但是手册上的打印结果时错的
$obj2->printHello(); // 输出 Public、Protected2 和 Undefined
输出结果应该是 Public2
From manual page: https://php.net/function.spl-autoload-register
错误
它有效的创建了自动加载函数队列,病按定义的顺序进行遍历。
正确
它有效的创建了自动加载函数队列,并按定义的顺序进行遍历。
From manual page: https://php.net/function.defined
原文:
此函数也可以跟累常量和 enum cases 一起工作。
正确为:
此函数也可以跟类常量和 enum cases 一起工作。
From manual page: https://php.net/filters.convert
https://www.php.net/manual/en/filters.convert.php
https://www.php.net/manual/zh/filters.convert.php
The description of convert.iconv.* is missing in Chinese
From manual page: https://php.net/language.namespaces.faq
---示例 #9 在双引号字符串中使用命名空间的危险性
From manual page: https://www.php.net/manual/zh/expect.examples-usage.php
Using the telnet protocol test, $match variable has always been null.
From manual page: https://php.net/function.ksort
php7
$data = [ "user_id" => 1, "0"=>1 ];
ksort($data);
var_dump($data);
result:
array(2) {
'user_id' =>int(1)
[0] =>int(1)
}
php8:
$data = [ "user_id" => 1, "0"=>1 ];
ksort($data);
var_dump($data);
result:
array(2) {
[0] =>int(1)
'user_id' => int(1)
}
From manual page: https://php.net/function.pack
url:https://www.php.net/manual/zh/function.pack.php
是否应为 大端和小端
From manual page: https://php.net/generator.send
Example (note the handling of null, which you would send to the generator to handle stragglers after the previous batch)
function importer()
{
$max = 500;
$items = [];
while (true) {
$item = yield;
if ($item !== null) {
$items[] = yield; //$item instead of yield,otherwise the $items will always have one item
}
if ($item === null || count($items) >= $max) {
// do batch operations
$items = [];
}
}
}
From manual page: https://www.php.net/download-docs.php
I would like to ask why the offline version of PHP user manual downloaded is blank when opened in Win10 environment.
From manual page: https://php.net/install.macosx.bundled
From manual page: https://php.net/function.call-user-func-array
---Uncaught Error: Cannot use positional argument after named argument
8之前的版本都是正常的,call_user_func_array 一个callback,一个array,哪来的positional argument!你们眼瞎还是心瞎了?乱改锤子呢!休你仙人了!**
From manual page: https://php.net/ini.core
From manual page: https://php.net/language.oop5.basic
language:Chinese(Simplified)
Calling a non-static method statically throws an Error. 翻译成了以静态方式去调用一个静态方法
应该改成 :以静态方式去调用一个非静态方法
From manual page: https://php.net/function.openssl-pkey-get-details
中文文档 :
type (如下密钥类型之一: OPENSSL_KEYTYPE_RSA, OPENSSL_KEYTYPE_DSA, OPENSSL_KEYTYPE_DH, OPENSSL_KEYTYPE_EC 或者 未知类型返回1)
英语文档:
type (type of the key which is one of OPENSSL_KEYTYPE_RSA, OPENSSL_KEYTYPE_DSA, OPENSSL_KEYTYPE_DH, OPENSSL_KEYTYPE_EC or -1 meaning unknown).
更正:
未知类型返回1 => 未知类型返回 -1
From manual page: https://php.net/pdo.lastinsertid
When the return value should be -1,
but 18446744073709551615 is returned
only in php8.1
<?php
class A
{
protected static $instance = null;
public static function getInstance(...$args)
{
if(!isset(self::$instance)){
self::$instance = new static(...$args);
}
return self::$instance;
}
public function getB()
{
return B::class::getInstance();
}
}
class B extends A
{
protected static $instance = null;
public static function getInstance(...$args)
{
if(!isset(self::$instance)){
self::$instance = new static(...$args);
}
return self::$instance;
}
}
var_dump(A::getInstance()->getB()); // B
<?php
trait Singleton
{
protected static $instance = null;
public static function getInstance(...$args)
{
if(!isset(self::$instance)){
self::$instance = new static(...$args);
}
return self::$instance;
}
}
class A
{
use Singleton;
public function getB()
{
return B::class::getInstance();
}
}
class B extends A
{
use Singleton;
}
var_dump(A::getInstance()->getB()); // A
From manual page: https://php.net/features.commandline.introduction
From manual page: https://php.net/function.is-object
当前的翻译内容是"is_object — 查找变量是否是字符串",翻译应该是"is_object — 查找变量是否是对象"。
比如该文件的更新历史:
https://github.com/php/doc-en/commits/master/appendices/migration80/other-changes.xml
已经有4次更新。但是中文版的地址commit却是英文的版本的第一次的 commit 。按照这个情况来说,待翻译文档应该会提示该文档后续有更新。应该进行提示才对呀。
难道说这个只能提示中文没有翻译的吗?😓
From manual page: https://php.net/function.getopt
原文:
Note:
The format for the short_options and long_options is almost the same, the only difference is that long_options takes an array of options (where each element is the option) whereas short_options takes a string (where each character is the option).
中文 (当前):
注意:
options 和 longopts 的格式几乎是一样的,唯一的不同之处是 longopts 需要是选项的数组(每个元素为一个选项),而 options 需要一个字符串(每个字符是个选项)。
options 和 longopts 应为 short_options 和 long_options
From manual page: https://php.net/curl.installation
specified curl-dir , still make default dir.
the Makefile CURL_SHARED_LIBADD
is empty
CURL_SHARED_LIBADD =
after make
the CURL
is still old version
From manual page: https://php.net/function.odbc-foreignkeys
--- The fifth and second parameters have the same name,the fifth parameter is fk_catalog or not ?
From manual page: https://php.net/function.settype
注意:
“int”的最小值是 [PHP_INT_MAX]
=>
“int”的最大值是 [PHP_INT_MAX]
Why is there no complete instructions for this function? What modules can I set and how to use it?
From manual page: https://php.net/function.session-module-name
From manual page: https://php.net/mysqli.installation
From manual page: https://php.net/class.reflector
From manual page: https://php.net/functions.arguments
php-src in /ext/standard/basic_functions.stub.php line 132
the second name is count, but php runtime and doc is num.
php-src:
function array_fill(int $start_index, int $count, mixed $value): array {}
doc-zh:
<?php
array_fill(value: 50, num: 100, start_index: 0);
?>
From manual page: https://php.net/function.touch
$dfile ='D:\touch_test\100.txt';
$efile ='E:\upan_disk\100.txt';
$dfile =str_replace('\', '/', $dfile);
$efile =str_replace('\', '/', $efile);
$mt_from =filemtime($dfile);
var_dump( 'dfile: '. $mt_from );
var_dump( 'efile: '. filemtime($efile) );
$stat =copy($dfile, $efile);
var_dump( $stat );
$stat =touch($efile, $mt_from);
var_dump( $stat );
I am using php7.4 version
session.save_path="tcp://127.0.0.1:6379?auth=wxdefa+6uysfs"
There is a + sign in the password, and the session will be invalid if the session is saved
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.