怎样将php与html链接,PHP的 - 如何解析从HTML与HTML标签的链接?

我有一个xml有一个href链接的问题,我不能以正确的顺序回显。PHP的 - 如何解析从HTML与HTML标签的链接?

XML:

290

204

420

70

SOME TEXT

[email protected]

SOME TEXT

我moduletext功能:

class modules

{

private $xml;

protected $build;

// div text

public $div_x, $div_y, $div_width, $div_height, $title, $post, $date, $caption_fontfamily, $caption, $caption_fontsize, $caption_color, $caption_ls, $serverEmail, $name, $email, $message, $src;

private $direction, $fontFamily, $af_color, $color, $bold, $italic, $underline, $af_bold, $af_italic, $af_underline, $size;

// P

public $p_attr_color, $p_attr_align, $p_attr_fontfamily, $p_attr_fontsize, $p_content, $p_content_temp;

// Image module

private $img_path, $img_x, $img_y, $img_rotation, $img_width, $img_height;

// Shape module

private $shape_x, $shape_y, $shape_width, $shape_height, $fill_color, $border_color, $border_size, $shape_type, $alpha, $rotation, $prettyPrinting, $opacity;

public function moduleText($xml,$print = '')

{

$this->xml = new SimpleXMLElement($xml);

// Plocka ut XML-data

$this->div_x = $this->xml->x;

$this->div_y = $this->xml->y;

$this->div_width = $this->xml->width;

$this->div_height = $this->xml->height;

$this->divStart = $this->xml->htmlText[0]->TEXTFORMAT->attributes->LEADING;

$this->build = '

';

foreach($this->xml->htmlText as $htmltext)

{

foreach($htmltext as $textformat)

{

$line_height = $textformat->attributes()->LEADING;

foreach($textformat as $p)

{

foreach($p as $font)

{

if(isset($font->A))

{

foreach($font->A as $link) {

$size = $link->attributes()->SIZE;

$target .= $link->attributes()->TARGET;

$this->build .= '

';

}

}

$fontsize = $font->attributes()->SIZE;

$fontfamily = str_ireplace(array('_'), array(''), $font->attributes()->FACE);

$fontcolor = $font->attributes()->COLOR;

$test = "1.305";

if(strlen($font) > 0) {

$this->build .= '

';

if(isset($font->A)) {

$this->build .= iconv('UTF-8','ISO-8859-1', str_ireplace(array('[b]','[/b]','[i]','[/i]'), array('','','',''), $font . '

'));

} else {

$this->build .= iconv('UTF-8','ISO-8859-1', str_ireplace(array('[b]','[/b]','[i]','[/i]'), array('','','',''), $font . '

'));

}

}

if(strlen($font->I) > 0) {

$this->build .= '

';

$this->build .= iconv('UTF-8','ISO-8859-1', str_ireplace(array('[b]','[/b]','[i]','[/i]'), array('','','',''), "".$font->I . '

'));

}

if(strlen($font->U) > 0) {

$this->build .= '

';

$this->build .= iconv('UTF-8','ISO-8859-1', str_ireplace(array('[b]','[/b]','[i]','[/i]'), array('','','',''), "".$font->U . ''));

$this->build .= '

';

}

if(strlen($font) == 0 && strlen($font->U) == 0 && strlen($font->I) == 0) {

$this->build .= '

}

}

}

}

}

$this->build .= '

';
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值