主页
PHP
PHP 命名空间
tryphp_namespace1
运行 ❯
×
更改方向
保存代码
更改主题
<?php namespace Html; class Table { public $title = ""; public $rows = 0; public function info() { echo "<p>$this->title has $this->rows rows.</p>"; } } $table = new \Html\Table(); $table->title = "My table"; $table->rows = 5; ?> <!DOCTYPE html> <html> <body> <?php $table->info(); ?> </body> </html>
My table has 5 rows.