svn: /phpdoc/kr/trunk/language/oop5/ serialization.xml

From: Date: Fri, 16 Jan 2015 15:08:45 +0000
Subject: svn: /phpdoc/kr/trunk/language/oop5/ serialization.xml
Groups: php.doc.kr 
Request: Send a blank email to doc-kr+get-1983@lists.php.net to get a copy of this message
acidd15 Fri, 16 Jan 2015 15:08:45 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=335767 Log: initial translate. Changed paths: U phpdoc/kr/trunk/language/oop5/serialization.xml Modified: phpdoc/kr/trunk/language/oop5/serialization.xml =================================================================== --- phpdoc/kr/trunk/language/oop5/serialization.xml 2015-01-16 14:28:41 UTC (rev 335766) +++ phpdoc/kr/trunk/language/oop5/serialization.xml 2015-01-16 15:08:45 UTC (rev 335767) @@ -16,16 +16,10 @@ </para> <para> - In order to be able to <function>unserialize</function> an object, the - class of that object needs to be defined. That is, if you have an object - of class A and serialize this, you'll - get a string that refers to class A and contains all values of variables - contained in it. If you want to be able to unserialize - this in another file, an object of class A, the - definition of class A must be present in that file first. - This can be done for example by storing the class definition of class A - in an include file and including this file or making use of the - <function>spl_autoload_register</function> function. + 객체를 <function>unserialize</function> 할수 있도록 하기 위해서는, 해당 객체의 클래스 정의가 필요 합니다. + 이 말은, 클래스 A의 객체를 직렬화 하면 클래스 A의 모든 변수들의 값을 포함하는 문자열을 얻게 됩니다. + 다른 파일에서 이 문자열을 역직렬화하여 클래스 A의 객체를 만들고자 할때 해당 파일에는 클래스 A가 먼저 정의 되어 있어야 합니다. + 이것은 클래스 A의 정의를 파일로 만들어 인클루드 하거나 <function>spl_autoload_register</function> 를 사용할 수 있습니다. </para> <informalexample> @@ -53,13 +47,13 @@ // page2.php: - // this is needed for the unserialize to work properly. + // 역직렬화를 위해 필요합니다. include("classa.inc"); $s = file_get_contents('store'); $a = unserialize($s); - // now use the function show_one() of the $a object. + // 이제 $a 객체의 show_one() 함수를 사용합니다. $a->show_one(); ?> ]]> @@ -67,38 +61,28 @@ </informalexample> <para> - If an application is using sessions and uses - <function>session_register</function> to register objects, these objects - are serialized automatically at the end of each PHP page, and are - unserialized automatically on each of the following pages. This means that - these objects can show up on any of the application's pages once they become - part of the session. However, the <function>session_register</function> is - removed since PHP 5.4.0. + 응용프로그램이 세션과 <function>session_register</function> 를 객체를 등록하기 위해 사용한다면 + 각 PHP 페이지의 마지막에서 이 객체들은 자동으로 직렬화됩니다. 그리고 각각의 페이지 첫부분에서 자동으로 역직렬화 됩니다. + 이 얘기는 세션이 공유되는 어떤 페이지에서든 객체를 다시 복원할 수 있음을 의미합니다. 그러나, <function>session_register</function> + 는 PHP 5.4.0 부터 제거 되었습니다. </para> <para> - It is strongly recommended that if an application serializes objects, for use - later in the application, that the application includes the class definition - for that object throughout the application. Not doing so might result in an - object being unserialized without a class definition, which will result in - PHP giving the object a class of <classname>__PHP_Incomplete_Class_Name</classname>, - which has no methods and would render the object useless. + 추후에 사용할 목적으로 객체를 직렬화 했다면, 해당 응용프로그램 전체에 클래스 정의를 포함하는것을 강력하게 추천합니다. + 그렇지 않으면 <classname>__PHP_Incomplete_Class_Name</classname> 클래스의 객체를 반환하게 되며 아무런 메서드도 가지지 않으며 + 객체가 쓸모없음을 표시할것입니다. </para> <para> - So if in the example above <varname>$a</varname> became part of a session - by running <literal>session_register("a")</literal>, you should include the - file <literal>classa.inc</literal> on all of your pages, not only <filename>page1.php</filename> - and <filename>page2.php</filename>. + 앞의 예제에서 <varname>$a</varname> 가 <literal>session_register("a")</literal> 로 세션이 되었다면, + <literal>classa.inc</literal> 파일을 <filename>page1.php</filename> + 와 <filename>page2.php</filename>뿐만이 아닌 모든 페이지에 인클루드 해야 합니다. </para> <para> - Beyond the above advice, note that you can also hook into the serialization - and unserialization events on an object using the - <link linkend="object.sleep">__sleep()</link> and - <link linkend="object.wakeup">__wakeup()</link> methods. Using - <link linkend="object.sleep">__sleep()</link> also allows you to only - serialize a subset of the object's properties. + 주제에 벗어나는 얘기지만, <link linkend="object.sleep">__sleep()</link> 과 + <link linkend="object.wakeup">__wakeup()</link> 메서드를 통해 객체의 직렬화와 역직렬화 이벤트를 후킹할 수 있습니다. + <link linkend="object.sleep">__sleep()</link> 은 또한 객체의 일부 프로퍼티만 직렬화 할수 있습니다. </para> </sect1>

« previous php.doc.kr (#1983) next »