也就是我可以这样用my_custom 'parms'?

我发现两种用法都可以require('functions.php')require 'functions.php',那么它在php中到底是语法还是函数呢?我们能否在自己写php插件时也实现这样的用法?

慕少森
浏览 118回答 2
2回答

慕哥9229398

语法Zend/zend_language_scanner.l<ST_IN_SCRIPTING>"eval"&nbsp;{ return&nbsp;T_EVAL; } <ST_IN_SCRIPTING>"include"&nbsp;{ return&nbsp;T_INCLUDE; } <ST_IN_SCRIPTING>"include_once"&nbsp;{ return&nbsp;T_INCLUDE_ONCE; } <ST_IN_SCRIPTING>"require"&nbsp;{ return&nbsp;T_REQUIRE; } <ST_IN_SCRIPTING>"require_once"&nbsp;{ return&nbsp;T_REQUIRE_ONCE; }Zend/zend_language_parser.yinternal_functions_in_yacc: T_ISSET&nbsp;'('&nbsp;isset_variables&nbsp;')'&nbsp;{&nbsp;$$&nbsp;=&nbsp;$3;&nbsp;} | T_EMPTY&nbsp;'('&nbsp;variable&nbsp;')' {&nbsp;zend_do_isset_or_isempty(ZEND_ISEMPTY,&nbsp;&$$,&nbsp;&$3&nbsp;TSRMLS_CC);&nbsp;} | T_INCLUDE&nbsp;expr&nbsp; {&nbsp;zend_do_include_or_eval(ZEND_INCLUDE,&nbsp;&$$,&nbsp;&$2&nbsp;TSRMLS_CC);&nbsp;} | T_INCLUDE_ONCE&nbsp;expr&nbsp; {&nbsp;zend_do_include_or_eval(ZEND_INCLUDE_ONCE,&nbsp;&$$,&nbsp;&$2&nbsp;TSRMLS_CC);&nbsp;} | T_EVAL&nbsp;'('&nbsp;expr&nbsp;')'&nbsp; {&nbsp;zend_do_include_or_eval(ZEND_EVAL,&nbsp;&$$,&nbsp;&$3&nbsp;TSRMLS_CC);&nbsp;} | T_REQUIRE&nbsp;expr {&nbsp;zend_do_include_or_eval(ZEND_REQUIRE,&nbsp;&$$,&nbsp;&$2&nbsp;TSRMLS_CC);&nbsp;} | T_REQUIRE_ONCE&nbsp;expr {&nbsp;zend_do_include_or_eval(ZEND_REQUIRE_ONCE,&nbsp;&$$,&nbsp;&$2&nbsp;TSRMLS_CC);&nbsp;} ;Zend/zend_compile.cvoid&nbsp;zend_do_include_or_eval(int&nbsp;type,&nbsp;znode&nbsp;*result,&nbsp;const&nbsp;znode&nbsp;*op1&nbsp;TSRMLS_DC)&nbsp;{ zend_do_extended_fcall_begin(TSRMLS_C); { zend_op&nbsp;*opline&nbsp;=&nbsp;get_next_op(CG(active_op_array)&nbsp;TSRMLS_CC); opline->opcode&nbsp;=&nbsp;ZEND_INCLUDE_OR_EVAL; opline->result_type&nbsp;=&nbsp;IS_VAR; opline->result.var&nbsp;=&nbsp;get_temporary_variable(CG(active_op_array)); SET_NODE(opline->op1,&nbsp;op1); SET_UNUSED(opline->op2); opline->extended_value&nbsp;=&nbsp;type; GET_NODE(result,&nbsp;opline->result); } zend_do_extended_fcall_end(TSRMLS_C); }

HUX布斯

require是 PHP 中的关键字。f()这样的用法并不意味着f是函数。例如,print('hi'也可以,但是&nbsp;print&nbsp;并非函数。
打开App,查看更多内容
随时随地看视频慕课网APP