English 中文(简体)
能够在购买力平价中设定一个真实变量
原标题:Can t set a variable to true in PHP

在我使用一流的豆类变异,但出于某种原因,在我想要将其设定为<代码>true时,它不做以下工作:

<?php


class TinyFram {



    private $urlMatched;


    public function get($url, $method){

        $urlR = str_replace( / ,  / , $url);
        $urlR =  ^  . $urlR .  /?$ ;

        if (preg_match("/$urlR/i", $reqURI, $rMatch)) {
            $this->urlMatched = true; // I SET IT TO TRUE HERE
            $method($rMatch);
        } 
        if(!$this->urlMatched) {
            echo var_dump($this->urlMatched); // BUT HERE IT SHOWS AS FALSE
            notFound($rMatch);
        }
    }

}

?>

什么是错的? 感谢!

最佳回答

你的预言——事项不相匹配,因此,变数永远不会变成现实。

问题回答

<代码>var_dump的条件是,核对thi->urlMatstal美元是否是一种幻觉价值(false, 0, 无)。 当然,它会证明是假的。

btw:var_dump 无需在它前面重复。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签