one day php. alomost all;

<?
namespace Test;
use \PhpProject\PhpApp as Other;
$u=new Other("ns test");
echo $u->GetUserName();
echo "annotation: use include, pls include \\ which is the common namespace, which need not to be declared as default \\";
echo "<br>";
echo __NAMESPACE__;
echo "<br><br><br><br>";
?>
<?
namespace PhpProject;
//php注释的写法
echo "above shows how to create php annotation<br>";
//php string 连写
$test="inner string";
echo "how are ".$test;
echo "how are:$test<br>";
global $test;
//php类的写法
$GLOBALS["a"]=121;
echo $GLOBALS["a"]."<br>";
 class PhpApp{
	function PhpApp($name){
		$this->self=$name;
        $this::__construct($name);
	}
    //below is alternate way to construct this class
	// function __construct(){
	// }
	public	function GetUserName(){
		return "how are you ".$this->self;
	}
	public static $Version;
	private $self;
    var $pty="pty json";
}
final class WebApp extends PhpApp{
	public function GetUserName(){
		return "webapp".parent::GetUserName();
	}
}
PhpApp::$Version="1.00";
$user=new PhpApp("ctor");
echo $user->GetUserName();
echo PhpApp::$Version;
$web=new WebApp("webapp");
echo $web->GetUserName();
 echo json_encode($user,1);
var_dump(json_encode($user));
interface IPhpApp{
    function ruin();
}
class MyPhp implements IPhpApp{
    function ruin(){
        echo "ruined";
    }
}
$m=new MyPhp();
$m->ruin();
时间: 2024-08-06 16:05:17

one day php. alomost all;的相关文章

IDEA 创建Web项目并在Tomcat中部署运行

IDEA 14.0.5 apache-tomcat-8.0.32 步骤:File->New Project,在Java列表中勾选Web Application(3.1),点击Next 建立web名称,选择下一步 弹出选项中建议选择New Window,这样比较方便,并勾选前面的勾,这样下次开发就不用考虑这个了,很方便 在WEB-INF下建立两个文件夹,分别为:classes和lib,在Eclipse中进行过开发的很清楚这两个文件夹的作用,classes可以存放编译过的Java文件,lib可以存放

[Webpack 2] Grouping vendor files with the Webpack CommonsChunkPlugin

Often, you have dependencies which you rarely change. In these cases, you can leverage the CommonsChunkPlugin to automatically put these modules in a separate bundled file so they can be cached and loaded separately from the rest of your code (levera

css的入门——css简介,颜色,文本

CSS简介 1.理解CSS:设想元素周围有一个看不见的盒子. CSS将样式规则与HTML元素相关联,CSS通过将规则与HTML元素相关联的方式来工作.这些规则用来控制指定元素中的内容如何显示.一条CSS规则包含两个部分:一个选择器和一条声明. p {font-family:Arial;} 这条规表明所有<p>元素都已更改用Arial字体来显示. 其中绿色部分为选择器,选择器表明要应用规则的元素.同一条规则可以应用在多个元素上,前提是你需要将这些元素名用逗号隔开. 蓝色部分是声明,声明用于表明应