Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 7.1.md #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions 7.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ ZEND_FUNCTION(sample_hello_world) {
如果传递给函数的参数数量小于zend_parse_parameters()要接收的参数数量,它便会执行失败,并返回FAILURE。
</div>
如果我们需要接收多个参数,可以直接在zend_parse_paramenters()的参数里罗列接收载体便可以了,如:

````php
<?php
function sample_hello_world($name, $greeting) {
Expand All @@ -87,6 +88,7 @@ function sample_hello_world($name, $greeting) {
sample_hello_world('John Smith', 'Mr.');

````

在PHP扩展里应该这样来实现:
````c
ZEND_FUNCTION(sample_hello_world) {
Expand Down Expand Up @@ -115,6 +117,7 @@ Type Modifier Meaning
````
### 函数参数的默认值
现在让我们继续改写sample_hello_world(), 接下来我们使用一些参数的默认值,在php语言里就像下面这样:

````php
<?php
function sample_hello_world($name, $greeting='Mr./Ms.') {
Expand Down