无法从PHP StdClass对象爆炸

无法从PHP StdClass对象爆炸

问题描述:

i am unable to explode an STDclass variable i have values in the object some what like mentioned below, but when i take the dump i get

I have stdClass Object ( [page_path] => 14-45-55 ). When i try to explode this

$pages = $database->executeObjectList("SELECT page_path FROM tblwebpages WHERE page_id=" . $_GET['id']);
$explodedString = explode('-', $pages->page_path);
print_r($explodedString);  
exit;

on taking dump of ($explodedString) i get

Array ( [0] => )

can i know what am i doing wrong if?

我无法分解STDclass变量我在对象中有一些值,如下所述,但是当我拿 我得到的转储 p>

我有 stdClass对象([page_path] => 14-45-55) code>。 当我试图爆炸这个 p>

  $ pages = $ database-> executeObjectList(“SELECT page_path FROM tblwebpages WHERE page_id =”。$ _GET ['id']); \  n $ explosionString = explode(' - ',$ pages-> page_path); 
print_r($ explosionString);  
exit; 
  code>  pre> 
 
 

关于转储($ explosionString)我得到 p>

 数组([0] =  >)
  code>  pre> 
 
 

我能知道我做错了吗? p> div>

Your $pages, according to your comment, is actually an array (containing an object).

You need to do this instead:

$explodedString = explode('-', $pages[0]->page_path);