Jackal Posted August 26, 2007 Report Posted August 26, 2007 Ir vajadzība uztaisīt automātiski jaunus objektus, bet problēma ir tāda, ka eval funkcijā ir ielikts $tmpl objekts un tādēļ izmet erroru Catchable fatal error: Object of class TemplatePower could not be converted to string in C:\Program Files\www\index.php on line 21 eval("$".$row['module']." = new ".$row['module']."(".$tmpl.");"); Kā varētu izlabot šo kļūdu?
andrisp Posted August 26, 2007 Report Posted August 26, 2007 eval("$".$row['module']." = new ".$row['module']."($tmpl);"); Bet vispār pričom eval() ? Bez nav iespējams ?
Jackal Posted August 26, 2007 Author Report Posted August 26, 2007 (edited) Tavs variants neiet, tas izmet tādu pašu kļūdu. Varbūt parādīsi kā to var izdarīt bez eval funkcijas? Edited August 26, 2007 by Jackal
bubu Posted August 26, 2007 Report Posted August 26, 2007 Gan jau, ka nevajadzēja " " pēdās likt to $tmp1. Vajag ' ' lietot.
Delfins Posted August 26, 2007 Report Posted August 26, 2007 $className = $row['module']; $$className = new $className($tmpl);
v3rb0 Posted August 26, 2007 Report Posted August 26, 2007 īsti nezinu ko vajag, bet vai ar parastu serialize() nepietiek?
Delfins Posted August 26, 2007 Report Posted August 26, 2007 verbo, tu vismaz zini ko dara serialize?
Recommended Posts