A
A
alex995052020-04-14 22:44:48
PHP
alex99505, 2020-04-14 22:44:48

How to escape $ in js block yii2?

$js = <<<JS
var $a = 'a';
JS;

You need to implement this syntax. But $a is treated as a php variable. How can you get around this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kim, 2020-04-14
@alex99505

It is possible to screen:

$js = <<<JS
var \$a = 'a';
JS;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question