Jackal Posted August 26, 2007 Report Share 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? Link to comment Share on other sites More sharing options...
andrisp Posted August 26, 2007 Report Share Posted August 26, 2007 eval("$".$row['module']." = new ".$row['module']."($tmpl);"); Bet vispār pričom eval() ? Bez nav iespējams ? Link to comment Share on other sites More sharing options...
Jackal Posted August 26, 2007 Author Report Share 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 Link to comment Share on other sites More sharing options...
bubu Posted August 26, 2007 Report Share Posted August 26, 2007 Gan jau, ka nevajadzēja " " pēdās likt to $tmp1. Vajag ' ' lietot. Link to comment Share on other sites More sharing options...
Delfins Posted August 26, 2007 Report Share Posted August 26, 2007 $className = $row['module']; $$className = new $className($tmpl); Link to comment Share on other sites More sharing options...
v3rb0 Posted August 26, 2007 Report Share Posted August 26, 2007 īsti nezinu ko vajag, bet vai ar parastu serialize() nepietiek? Link to comment Share on other sites More sharing options...
Delfins Posted August 26, 2007 Report Share Posted August 26, 2007 verbo, tu vismaz zini ko dara serialize? Link to comment Share on other sites More sharing options...
v3rb0 Posted August 26, 2007 Report Share Posted August 26, 2007 nezinu gan :) Link to comment Share on other sites More sharing options...
Recommended Posts