|
|
|
ค่า Array หาไปไหน ช่วยมาดูที่คับ ผม คือ ใน $search[$key] มี ค่า แต่ ใน print_r($search) ไม่มีค่า ช่วยที่คับ |
|
|
|
|
|
|
|
Code (PHP)
<?php
$rows = Array
(
"0" => Array
(
"title" => "Australia",
"body" => '<!--paging_filter--><p><a href="http://www.boeing.com.au">Boeing Australia Limited</a></p>',
"field_joindate_value" => "21 February 2001"
),
"1" => Array
(
"title" => "Australia",
"body" => '<!--paging_filter--><p><a target="_blank" href="http://www.ericsson.com.au">Ericsson Australia Pty Limited</a></p>',
"field_joindate_value" => "02 September 1997"
)
);
echo "<pre>";
print_r($rows);
echo "</pre>";
foreach ($rows as $key => $value){
$arr = explode ( ">",$value[body] );
/*echo "<pre>";
print_r($arr);
echo "</pre>";*/
foreach ($arr as $arrkey => $arrvalue){
$sub = substr($arrvalue, 0, 1);
//echo "<br/>".substr($arrvalue, 0, 1)."<br/>";
if($sub != "<"){
echo $arrvalue ;
$search = array();
$string = $arrvalue ;
//$string = htmlentities ( $arrvalue );
//print $string."<br/>";
//$string = trim ( $string );
//$string = html_entity_decode ( $string );
//print $string."<br/>";
$search[$key] = $string ;
//echo "<br/>".$search[$key]."<br/>";
}
//echo "<br>".$arrvalue."<br/>";
}
}
echo "<pre>";
print_r($search);
echo "</pre>";
?>
คือ ใน $search[$key] มี ค่า แต่ ใน print_r($search) ไม่มีค่า ช่วยที่คับ
Tag : PHP
|
|
|
|
|
|
Date :
2011-01-18 13:33:57 |
By :
thebells |
View :
969 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?php
$rows = Array
(
"0" => Array
(
"title" => "Australia",
"body" => '<!--paging_filter--><p><a href="http://www.boeing.com.au">Boeing Australia Limited</a></p>',
"field_joindate_value" => "21 February 2001"
),
"1" => Array
(
"title" => "Australia",
"body" => '<!--paging_filter--><p><a target="_blank" href="http://www.ericsson.com.au">Ericsson Australia Pty Limited</a></p>',
"field_joindate_value" => "02 September 1997"
)
);
/*echo "<pre>";
print_r($rows);
echo "</pre>";
$search = array();
foreach ($rows as $key => $value){
$arr = explode ( ">",$value[body] );
/*echo "<pre>";
print_r($arr);
echo "</pre>";*/
foreach ($arr as $arrkey => $arrvalue){
//echo $arrvalue ;
$arrvalue = trim ( $arrvalue );
$sub = substr($arrvalue, 0, 1);
//echo "<br/>".substr($arrvalue, 0, 1)."<br/>";
if($sub != "<" && $sub != ""){
//echo $arrvalue ;
//$search = array();
$string = $arrvalue ;
//$string = htmlentities ( $arrvalue );
//print $string."<br/>";
$string = trim ( $string );
$max = strlen ($string);
$new = substr ( $string,0,$max-3 );
//$string = html_entity_decode ( $string );
//print $string."<br/>";
$search[$key] = $new ;
echo "<br/>".$search[$key]."<br/>";
}
//echo "<br>".$arrvalue."<br/>";
//echo "<br/>".$search[$key]."<br/>";
//$to = $search[$key] ;
}
//$to = $search[$key] ;
//echo "<br/>".$search[$key]."<br/>";
}
echo "<pre>";
print_r($search);
echo "</pre>";
?>
โทษที่ เขียนได้ละ
|
|
|
|
|
Date :
2011-01-18 16:12:53 |
By :
thebells |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?php
$rows = Array
(
"0" => Array
(
"title" => "Australia",
"body" => '<!--paging_filter--><p><a href="http://www.boeing.com.au">Boeing Australia Limited</a></p>',
"field_joindate_value" => "21 February 2001"
),
"1" => Array
(
"title" => "Australia",
"body" => '<!--paging_filter--><p><a target="_blank" href="http://www.ericsson.com.au">Ericsson Australia Pty Limited</a></p>',
"field_joindate_value" => "02 September 1997"
)
);
$search = array();
foreach ($rows as $key => $value){
$arr = explode ( ">",$value[body] );
/*echo "<pre>";
print_r($arr);
echo "</pre>";*/
foreach ($arr as $arrkey => $arrvalue){
//echo $arrvalue ;
$arrvalue = trim ( $arrvalue );
$sub = substr($arrvalue, 0, 1);
//echo "<br/>".substr($arrvalue, 0, 1)."<br/>";
if($sub != "<" && $sub != ""){
//echo $arrvalue ;
//$search = array();
$string = $arrvalue ;
//$string = htmlentities ( $arrvalue );
//print $string."<br/>";
$string = trim ( $string );
$max = strlen ($string);
$new = substr ( $string,0,$max-3 );
//$string = html_entity_decode ( $string );
//print $string."<br/>";
$search[$key] = $new ;
echo "<br/>".$search[$key]."<br/>";
}
//echo "<br>".$arrvalue."<br/>";
//echo "<br/>".$search[$key]."<br/>";
//$to = $search[$key] ;
}
//$to = $search[$key] ;
//echo "<br/>".$search[$key]."<br/>";
}
echo "<pre>";
print_r($search);
echo "</pre>";
?>
|
|
|
|
|
Date :
2011-01-18 16:14:33 |
By :
thebells |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|