PHP 8.5.0 Alpha 2 available for testing

tidyNode::isAsp

(PHP 5, PHP 7, PHP 8)

tidyNode::isAspComprueba si el nodo es ASP

Descripción

public tidyNode::isAsp(): bool

Indica cuando el nodo actual es ASP.

Parámetros

Esta función no contiene ningún parámetro.

Valores devueltos

Devuelve true si el nodo es código ASP, false de lo contrario.

Ejemplos

Ejemplo #1 Extraer el código ASP embebido en un documento HTML

<?php

$html
= <<< HTML
<html><head>
<?php echo '<title>titulo</title>'; ?>
<#
/* código JSTE */
alert('Hola Mundo');
#>
</head>
<body>

<?php
// código PHP
echo 'Hola Mundo!';
?>

<%
/* código ASP */
response.write("Hola Mundo!")
%>

<!-- Comentarios -->
Hola Mundo
</body></html>
Fuera del HTML
HTML;


$tidy = tidy_parse_string($html);
$num = 0;

get_nodes($tidy->html());

function
get_nodes($node) {

// Verifica si el nodo actual es del tipo requerido
if($node->isAsp()) {
echo
"\n\n# asp node #" . ++$GLOBALS['num'] . "\n";
echo
$node->value;
}

// Verifica si el nodo actual tiene hijos
if($node->hasChildren()) {
foreach(
$node->child as $child) {
get_nodes($child);
}
}
}

?>

El ejemplo anterior mostrará :

# asp node #1
<%
  /* código ASP */
  response.write("Hola Mundo!")
%>

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top