本文介绍了如何用PHP编写一个简单的对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个很简单的问题,但我似乎找不到合适的答案.

this is quite an easy question but I couldn't seem to find a proper answer.

假设我在 actionScript 3 中编写了一个这样的对象:

Let's say I am writing in actionScript 3 an object like this:

var myCar = new Object();
myCar.engine = "Nice Engine";
myCar.numberOfDoors = 4;
myCar.howFast= 150;

如何用 PHP 写这样的东西?

how do I write such a thing in PHP?

推荐答案

$myCar = new stdClass;
$myCar->engine = 'Nice Engine';
$myCar->numberOfDoors = 4;
$myCar->howFast = 150;

查看对象文档,了解更多信息-深入讨论.

Have a look at the documentation for objects for a more in-depth discussion.

这篇关于如何用PHP编写一个简单的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 01:12