Simple class

Hi, this simple class dont show the message And... i dont know why
[php]

Ejemplo clase <?php class persona{ private $nombre = 'Juan';
public function accion(){
	echo "Hola";
}

}

$p=new persona();
$p->accion();

?>

[/php]

What comes out on the browser is
accion(); ?>

I tested your code and it worked perfectly, Shows Hola…

As you can see here.

http://www.phphelp.com/forum/membershelp/yonerflashtest.php

Then the problem most be on xampp
I put this route
http://localhost/ejercicios_basicos/clase.htm

What is going on?

Try renaming the extension from .htm to .php

I don’t know much about xaamp, but if it’s anything like IIS, you’ll have to tell your xaamp server to execute .htm files with PHP.

This is what you need to do to make xaamp run .htm as php.

Stop the apache service, then add one change in c:\xampp\apache\conf\httpd.conf in the section by adding…

AddType application/x-httpd-php .html .htm

Restart apache!

it worked, thanks man

Sponsor our Newsletter | Privacy Policy | Terms of Service