ci - CodeIgniter 프레임워크 Router.php 소스 코드에 문제가 있습니까?

WBOY
풀어 주다: 2023-03-03 10:40:02
원래의
992명이 탐색했습니다.

ci 프레임워크의 systemcoreRouter.php 파일에서 132번째 줄의 시작 코드는 다음과 같습니다.

<code>    is_array($routing) && isset($routing['directory']) && $this->set_directory($routing['directory']);
    $this->_set_routing();

    // Set any routing overrides that may exist in the main index file
    if (is_array($routing))
    {
        empty($routing['controller']) OR $this->set_class($routing['controller']);
        empty($routing['function'])   OR $this->set_method($routing['function']);
    }</code>
로그인 후 복사
로그인 후 복사

우선 첫 번째 줄은 다음과 같습니다.
is_array($routing) && isset($routing['directory']) && $this->set_directory($routing['directory']);
이렇게 쓰는 것이 말이 되는지 잘 모르겠습니다. 이러한 표현의 결과(참 또는 거짓)에 아무런 판단도 추가되지 않으면 그 결과(참 또는 거짓)의 목적은 무엇입니까? , if 판단문에서는 공허한 판단을 사용하세요. 저도 두 결과가 의미가 없다고 생각합니다. 판단을 내리지 않으면 이렇게 쓸 생각이 있으신가요?
조언 부탁드립니다.

답글 내용:

ci 프레임워크의 systemcoreRouter.php 파일에서 132번째 줄의 시작 코드는 다음과 같습니다.

<code>    is_array($routing) && isset($routing['directory']) && $this->set_directory($routing['directory']);
    $this->_set_routing();

    // Set any routing overrides that may exist in the main index file
    if (is_array($routing))
    {
        empty($routing['controller']) OR $this->set_class($routing['controller']);
        empty($routing['function'])   OR $this->set_method($routing['function']);
    }</code>
로그인 후 복사
로그인 후 복사
우선 첫 번째 줄은 다음과 같습니다.

is_array($routing) && isset($routing['directory']) && $this->set_directory($routing['directory']);
이렇게 쓰는 것이 말이 되는지 잘 모르겠습니다. 이러한 표현의 결과(참 또는 거짓)에 아무런 판단도 추가되지 않으면 그 결과(참 또는 거짓)의 목적은 무엇입니까? , if 판단문에서는 빈 판단을 사용하세요. 저도 두 결과가 의미가 없다고 생각합니다. 판단을 내리지 않으면 이렇게 쓸 생각이 있으신가요?
조언 부탁드립니다. >

이 기호가

<code>is_array($routing) && isset($routing['directory']) && $this->set_directory($routing['directory']);

</code>
로그인 후 복사
인거 아시나요?

즉, &&true + true가 성공적으로 실행되어야 세 번째가 모두 성공적으로 실행되어야 하며, 그렇지 않으면 실행되지 않습니다. 다른 쓰기 방식으로 변경할 수 있습니다.
第一个 第二个당신의 생각은 매우 명확합니까?

<code>if (is_array($routhing) && isset($routing['directory'])) {
    $this->set_directory($routing['directory']);
}
</code>
로그인 후 복사
왜 이러는 걸까요?

이러는 거죠?

&&

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
최신 이슈
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!