开发者

500 error preg_replace_callback when using function ($match) use ($video){}

开发者 https://www.devze.com 2023-04-13 01:50 出处:网络
Works on my localhost running php 5.3.4 Does not work on my VPS h开发者_开发问答ostgator account running 5.3.6

Works on my localhost running php 5.3.4

Does not work on my VPS h开发者_开发问答ostgator account running 5.3.6

The problem here seems to be the "use" keyword

Code Below

<?php

$video = $this->Video;

$post['Post']['body'] =
    preg_replace_callback("/\[\[audio=(.*)\]\]/", function ($match) use ($video) {
        return $video->show(array('video' => $match[1]));
    }, $post['Post']['body']);

?>

Many thanks for you help.


I had our server admin update the server to 5.3.8 and everything works as normal. Not sure what the problem really was.

0

精彩评论

暂无评论...
验证码 换一张
取 消