CJavaScriptExpression represents a JavaScript expression that does not need escaping.
It can be passed to CJavaScript::encode() and the code will stay as is.
public function __construct($code) { if(!is_string($code)) throw new CException('Value passed to CJavaScriptExpression should be a string.'); if(strpos($code, 'js:')===0) $code=substr($code,3); $this->code=$code; }
Total 1 comment
$jsObj = new CJavaScriptExpression('console.log("please check yo log!")'); echo $jsObj;
Leave a comment
Please login to leave your comment.