2017-01-07 2 views
0

오후의 여러분! 내 PHP 코드에서 어떤 이유로 단지 (곱슬) 구문에 대한컴플렉스 (곱슬) 구문 PHP

내가보기 ('인덱스') 코드를 호출하고 여기에

function view($name, $data = []) 
{ 
    require __DIR__ . '/../app/views/{$name}.view.php'; 
} 

변수

로 통역하지 않습니다; 누군가가 당신의 도움에 대한 7.0.13

감사를 요청하기 전에 그런데 내 PHP 버전을

Warning: require(./core/../app/views/{$name}.view.php): failed to open stream 

: 문제는이 오류를 얻을 수 있습니다! ..

답변

2

귀하의 문자열은

봐 여기 그렇지 않으면 변수가 교체되지 않습니다 대신 작은 따옴표 (')의 큰 따옴표 (")에 배치 할 수 있습니다 https://secure.php.net/manual/en/language.types.string.php#language.types.string.syntax.single

Note: Unlike the double-quoted and heredoc syntaxes, variables and escape sequences for special characters will not be expanded when they occur in single quoted strings.

+0

물론 화려한! 힘내 친구 야! – Imphusius