누군가가 위의 문에 대한 자세한 설명을 제공하시기 바랍니다 수
$tmp = @$_GET['myValue'];
을 의미 필요?
누군가가 위의 문에 대한 자세한 설명을 제공하시기 바랍니다 수
$tmp = @$_GET['myValue'];
을 의미 필요?
@ 기호 오류 억제 연산자이다. 어디에서나 사용하는 것은 권장하지 않습니다. 또한 isset() 함수보다 두 배 느립니다. @ 오류 제어 연산자에 대한 자세한 내용은 http://php.net/manual/en/language.operators.errorcontrol.php
존재하는 경우 tmp
에 GET 매개 변수 myValue
의 값을 지정합니다. 그렇지 않다면 - tmp = null
추신 : 그것은 나쁜 습관입니다. 더 나은 방법은 다음과 같습니다.
$tmp = isset($_GET['myValue']) ? $_GET['myValue'] : null;
here 설명서를 참조하십시오.
@ : to avoid warning
$_GET : An associative array of variables passed to the current script via the URL parameters.
myval : parameter
-
예
http://example.com/?myval=test
echo @$_GET['myval']; will echo test
http://example.com/
echo @$_GET['myval']; will be null
//php 5.4 way is
var_dump(isset($_GET['myValue']) ? : null);