>  기사  >  백엔드 개발  >  Parse error: syntax error, unexpected T_FUNCTION, expecting ')'该如何解决

Parse error: syntax error, unexpected T_FUNCTION, expecting ')'该如何解决

WBOY
WBOY원래의
2016-06-13 12:17:544450검색

Parse error: syntax error, unexpected T_FUNCTION, expecting ')'
$c = array_map(function($chicun, $max_chicun) { return $chicun > $max_chicun ? 1 : 0; }, $chicun, $max_chicun);

报错Parse error: syntax error, unexpected T_FUNCTION, expecting ')'
请问什么原因?测试服务器上是没问题的,放在正式用的服务器上就报错
------解决思路----------------------
闭包只在 php 5.3 及以后才有,请检查你的 php 版本

其他的途径
1、定义常规函数用于回调
2、用 create_function 建立回调函数

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.