Answer the question
In order to leave comments, you need to log in
Why is the function not being executed?
We have such a PHP script that gives javascript:
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/core/config.php");
require_once(ABSPATH . "core/functions.php");
header("Content-type: application/javascript; charset=utf-8");
?>
<?php
// вот тут проблема.
// функция не выполняется
// нв выходе получаем строку is_auth = ;
// а должно быть true или false
echo "is_auth = ".is_auth().";\r\n";
?>
$(document).ready(function(){
/*
* ОБРАБОТЧИКИ
*/
// еще куча кода
// кстати PHP константы нормально выводятся в контексте js
Answer the question
In order to leave comments, you need to log in
That's right. Look at the output of the command "echo false;" - empty line.
php > echo "is_auth = " . false . ";\r\n";
is_auth = ;
php > echo "is_auth = " . json_encode(false) . ";\r\n";
is_auth = false;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question