<tfoot id='NaHJO'></tfoot>

      <i id='NaHJO'><tr id='NaHJO'><dt id='NaHJO'><q id='NaHJO'><span id='NaHJO'><b id='NaHJO'><form id='NaHJO'><ins id='NaHJO'></ins><ul id='NaHJO'></ul><sub id='NaHJO'></sub></form><legend id='NaHJO'></legend><bdo id='NaHJO'><pre id='NaHJO'><center id='NaHJO'></center></pre></bdo></b><th id='NaHJO'></th></span></q></dt></tr></i><div id='NaHJO'><tfoot id='NaHJO'></tfoot><dl id='NaHJO'><fieldset id='NaHJO'></fieldset></dl></div>
        • <bdo id='NaHJO'></bdo><ul id='NaHJO'></ul>

        <small id='NaHJO'></small><noframes id='NaHJO'>

        <legend id='NaHJO'><style id='NaHJO'><dir id='NaHJO'><q id='NaHJO'></q></dir></style></legend>
      1. 将对象从一页移动到另一页?

        时间:2023-10-13
        <i id='DSLwa'><tr id='DSLwa'><dt id='DSLwa'><q id='DSLwa'><span id='DSLwa'><b id='DSLwa'><form id='DSLwa'><ins id='DSLwa'></ins><ul id='DSLwa'></ul><sub id='DSLwa'></sub></form><legend id='DSLwa'></legend><bdo id='DSLwa'><pre id='DSLwa'><center id='DSLwa'></center></pre></bdo></b><th id='DSLwa'></th></span></q></dt></tr></i><div id='DSLwa'><tfoot id='DSLwa'></tfoot><dl id='DSLwa'><fieldset id='DSLwa'></fieldset></dl></div>
          <bdo id='DSLwa'></bdo><ul id='DSLwa'></ul>
        • <legend id='DSLwa'><style id='DSLwa'><dir id='DSLwa'><q id='DSLwa'></q></dir></style></legend>

            <small id='DSLwa'></small><noframes id='DSLwa'>

                  <tfoot id='DSLwa'></tfoot>
                    <tbody id='DSLwa'></tbody>
                1. 本文介绍了将对象从一页移动到另一页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  伙计们.我对 PHP 中的 OOP 有点陌生.我已经学会了如何编写和创建对象.有没有办法获取一个对象并将其传递给另一个脚本?使用 GET 或 POST 或 SESSION 或其他.如果没有,我将如何在一个页面上为对象分配一些变量,然后在另一页上为同一对象分配更多变量?

                  Hay guys. I'm kinda new to OOP in PHP. I've learnt how to write and create objects. Is there a way to take an object and pass it to another script? either using GET or POST or SESSION or whatever. If there isn't how would i assign an object some variables on one page, then assign the same object more variables on another page?

                  谢谢

                  推荐答案

                  您可以在会话中存储对象,但您需要在调用 session_start() 之前包含包含类定义的文件(或使用 类自动加载 并在开始会话之前进行设置).例如:

                  You can store objects in the session but you need to include the file which contains the class definition before calling session_start() (or use class autoloading and set this up before you start the session). For example:

                  在每一页上:

                  //include class definition
                  require('class.php');
                  
                  //start session
                  session_start();
                  

                  第一页:

                  $object = new class();
                  $object->someProperty = 'hello';
                  
                  //store in session
                  $_SESSION['object'] = $object;
                  

                  后续页面:

                  $object = $_SESSION['object'];
                  
                  //add something else, which will be stored in the session
                  $object->anotherPropery = 'Something';
                  

                  这篇关于将对象从一页移动到另一页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何通过 PHP 访问 RESTful API 下一篇:使用没有值的 GET 参数(在 URL 中)是一种不好的做法吗?

                  相关文章

                  <i id='9SQBd'><tr id='9SQBd'><dt id='9SQBd'><q id='9SQBd'><span id='9SQBd'><b id='9SQBd'><form id='9SQBd'><ins id='9SQBd'></ins><ul id='9SQBd'></ul><sub id='9SQBd'></sub></form><legend id='9SQBd'></legend><bdo id='9SQBd'><pre id='9SQBd'><center id='9SQBd'></center></pre></bdo></b><th id='9SQBd'></th></span></q></dt></tr></i><div id='9SQBd'><tfoot id='9SQBd'></tfoot><dl id='9SQBd'><fieldset id='9SQBd'></fieldset></dl></div>
                2. <small id='9SQBd'></small><noframes id='9SQBd'>

                  • <bdo id='9SQBd'></bdo><ul id='9SQBd'></ul>
                  <tfoot id='9SQBd'></tfoot>
                  1. <legend id='9SQBd'><style id='9SQBd'><dir id='9SQBd'><q id='9SQBd'></q></dir></style></legend>