2010-03-17 3 views
0
$embedCode = <<<EOF 
getApplicationContent('video','player',array('id' => $iFileId, 'user' => $this->iViewer, 'password' => clear_xss($_COOKIE['memberPassword'])),true) 
EOF; 
$name = str_replace($embedCode,"test",$content); 

나는 다른 코드와 함께 코드 섹션을 바꾸려고합니다. 나는 작은 문자열을 함께 할 수 있지만 내가 $ embedCode에 더 큰 문자열을 추가하면, 그것은 $ _COOKIEPHP 코드의 부분을 str_replace하는 방법

어쨌든 당신이 찾고있는 것 같습니다 근처 memberPassword 주위에 "예상치 못한 T_ENCAPSED_AND_WHITESPACE"오류를

+0

왜 이걸하고 싶니? –

답변

0

아래 제안

$sample = 'qwe $asd zxc'; 

'로 제한하지만 일반 문자열 정의 또는 Marcx로 \와 $ 탈출 내부 변수를 해석하지 언어 건설 당신의 목표는 당신이 변수의 실제 값을 사용하려면 바르 이름을 사용하는 경우 $\$

$embedCode = <<<EOF 
    getApplicationContent('video','player',array('id' => \$iFileId, 'user' => \$this->iViewer, 'password' => clear_xss(\$_COOKIE['memberPassword'])),true) 
EOF; 

를 사용하여, Netscape로, 다음 문제는 $ this-에> iViewer ...

+0

실제로 문제는 '$ this-> iViewer가 아닌 $ _COOKIE에 있습니다. – zerkms

0

제거 '를 던져 그럼 당신이하지 히어 닥 구문을 사용해야 - - 당신이 유를해야

관련 문제