localmente tengo funcionando correctamente una clase asi:
doc_type.php:
Código PHP:
require_once($_SERVER['DOCUMENT_ROOT']."/carro/clase_carro.php");
session_start();
require_once($_SERVER["DOCUMENT_ROOT"]."/includes/constantes.php");
if (!isset($_SESSION["id"])) {
$_SESSION["id"]=session_id();
$_SESSION["carrito"]=new Carro();
}
Código:
Si hago el session_start antes de la declaracion de la clase, el carro no funciona (deja el siguiente error:Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /public_html/carro_mio/clase_carro.php:51) in /public_html/includes/doc_type.php on line 6
Código:
en head_s.php linea 28 tengo Fatal error: main() [<a href='function.main'>function.main</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Carro" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /public_html/head_s.php on line 28
Código PHP:
$_SESSION["carrito"]->total_productos();