2009-12-09 5 views
1

예를 들어이 세션에서 값을 가져와야합니다. 어떻게해야합니까? 정확히 "customer_log_id"을 가져와야합니다.magento로 배열 값을 검색하는 방법

> Array (
>  [core] => Array 
>   (
>    [_session_validator_data] => Array 
>     (
>      [remote_addr] => 127.0.0.1 
>      [http_via] => 
>      [http_x_forwarded_for] => 
>      [http_user_agent] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 
>    ) 
> 
>    [session_hosts] => Array 
>     (
>      [127.0.0.1] => 1 
>    ) 
> 
>    [messages] => Mage_Core_Model_Message_Collection 
> Object 
>     (
>      [_messages:protected] => Array 
>       (
>      ) 
> 
>      [_lastAddedMessage:protected] => 
>    ) 
> 
>    [visitor_data] => Array 
>     (
>      [] => 
>      [server_addr] => 2130706433 
>      [remote_addr] => 2130706433 
>      [http_secure] => 
>      [http_host] => 127.0.0.1 
>      [http_user_agent] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 
>      [http_accept_language] => 
> en-us,en;q=0.5 
>      [http_accept_charset] => 
> ISO-8859-1,utf-8;q=0.7,*;q=0.7 
>      [request_uri] => /currentproject/magento/index.php/customer/account/ 
>      [session_id] => 34989ee1673caefec0d887dd41198587 
>      [http_referer] => http://127.0.0.1/currentproject/magento/index.php/customer/account/login/ 
>      [first_visit_at] => 2009-12-04 11:20:24 
>      [is_new_visitor] => 
>      [last_visit_at] => 2009-12-04 11:32:26 
>      [visitor_id] => 208 
>      [last_url_id] => 1399 
>      [catalog_compare_items_count] => 0 
>      [do_customer_login] => 
>      [customer_id] => 1 
>      [customer_log_id] => 8 
>    ) 
> 
>    [last_url] => http://127.0.0.1/currentproject/magento/index.php/customer/account/index/ 
>    [just_voted_poll] => 
>  ) 
> 
>  [_cookie_revalidate] => 1259926524 
>  [customer_base] => Array 
>   (
>    [_session_validator_data] => Array 
>     (
>      [remote_addr] => 127.0.0.1 
>      [http_via] => 
>      [http_x_forwarded_for] => 
>      [http_user_agent] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 
>    ) 
> 
>    [session_hosts] => Array 
>     (
>      [127.0.0.1] => 1 
>    ) 
> 
>    [messages] => Mage_Core_Model_Message_Collection 
> Object 
>     (
>      [_messages:protected] => Array 
>       (
>      ) 
> 
>      [_lastAddedMessage:protected] => 
>    ) 
> 
>    [id] => 1 
>  ) 
> 
>  [checkout] => Array 
>   (
>    [_session_validator_data] => Array 
>     (
>      [remote_addr] => 127.0.0.1 
>      [http_via] => 
>      [http_x_forwarded_for] => 
>      [http_user_agent] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 
>    ) 
> 
>    [session_hosts] => Array 
>     (
>      [127.0.0.1] => 1 
>    ) 
> 
>    [quote_id_1] => 
>  ) 
> 
>  [catalog] => Array 
>   (
>    [_session_validator_data] => Array 
>     (
>      [remote_addr] => 127.0.0.1 
>      [http_via] => 
>      [http_x_forwarded_for] => 
>      [http_user_agent] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 
>    ) 
> 
>    [session_hosts] => Array 
>     (
>      [127.0.0.1] => 1 
>    ) 
> 
>    [messages] => Mage_Core_Model_Message_Collection 
> Object 
>     (
>      [_messages:protected] => Array 
>       (
>      ) 
> 
>      [_lastAddedMessage:protected] => 
>    ) 
> 
>  ) 
> 
>  [newsletter] => Array 
>   (
>    [_session_validator_data] => Array 
>     (
>      [remote_addr] => 127.0.0.1 
>      [http_via] => 
>      [http_x_forwarded_for] => 
>      [http_user_agent] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 
>    ) 
> 
>    [session_hosts] => Array 
>     (
>      [127.0.0.1] => 1 
>    ) 
> 
>  ) 
> 
>) 
+0

이 어레이를 어디서 구할 수 있습니까? –

답변

1
$a['core']['visitor_data']['customer_log_id'] 
+0

많은 분들 Lindqvist ... 완벽한 답변 – Fero

1

당신이 $_SESSION 배열에서 정보를 검색하려는 것으로 보인다. 당신이 이것을 할 수있는 두 가지 방법이 있습니다. 또 다른 포스터가 제안한 것처럼, 당신은 단순히 슈퍼 전역 thusly 히 $_SESSION 밖으로 해킹 할 수

$logId = $_SESSION['core']['visitor_data']['customer_log_id']; 

그러나, 이것은 젠토 프레임 워크를 피하기 위해 해킹의 비트입니다. Magento의 세션 관리를 사용하는 것이 "정확성"의 관점에서 더 좋은 옵션입니다. 그래서 대신, 우리는 가지고있다 :

희망이있다!

+1

감사합니다. Mastey ... U는 magento에서 배열 값을 가져 오는 또 다른 새로운 방법을 보여줍니다. 당신의 대답에 대해 많은 감사드립니다. – Fero

관련 문제