steps.php정의되지 않은 변수와 정의되지 않은 인덱스
<?php
function allowed_in($steps){
$steps = array('Text1.php', 'Text2.php', 'Text3.php');
$latestStep = $_SESSION['latestStep'];
}
?>
Text1.php :
<?php
if(allowed_in($steps)){
//all code in the create_session.php
}
?>
나는 vairable 세션에 PHP 변수를 저장하고있는 기능에 액세스하려고 다른 페이지가 표시되지만 다음 오류가 발생합니다.
Notice: Undefined variable: steps in ... on line 28
Notice: Undefined index: latestStep in ... on line 49
이 오류를 수정하는 방법을 묻기 만하면됩니다. $_SESSION
변수에 if(isset())
이 필요합니까?
UPDATE : 아래는
전체 코드입니다 :
function allowed_in($pased_vars){
//your code
if($foo){
return 1;
}else{
return 0;
}
}
on included pages
<?php
//include file with code
if(allowed_in($vars)){
//allowed
}else{
//not
}
첫 번째는 '$ steps' i '$ steps = ... '을하기 전에 사용하고 있습니다. 두 번째는 배열 색인과 동일합니다. – cmbuckley
'$ latestStep = isset ($ _ SESSION [ 'latestStep'])? $ _SESSION [ 'latestStep'] : null;' – Leri
[PHP : "Notice : 정의되지 않은 변수"및 "Notice : 정의되지 않은 인덱스"] (http://stackoverflow.com/questions/4261133/php-notice-undefined) -variable-and-notice-undefined-index) – Jocelyn