I need to JSONize some data without quotes around the values for Javascript purposes.
I am following examples like
$data = array(
'onClick' => new Zend_Json_Expr('function() {'
. 'alert("I am a valid javascript callback '
. 'created by Zend_Json"); }'),
'other' => 'no expression',
);
$jsonObjectWithExpression = Zend_Json::encode(
$data,
false,
array('enableJsonExprFinder' => true)
);
and then returning the $jsonObjectWithExpression, but I get an exception
Fatal error: Call to undefined function Zend_Json_Expr() in ...
I'm pretty sure my version 1.10.8 supports this feature, since I can see the class in json/Expr.php
Do I need to import/include this class somehow? I haven't had to import any othe开发者_JAVA百科r Zend classes..
You may use Zend_Autoloader
or Zend_Application
or just require_once('/path/to/Zend/Json/Expr.php')
Are you sure you're using the new keyword?
The error message seems to state you're attempting to call a function named Zend_Json_Expr
精彩评论