C#中枚举Enum的写法:
/// <summary>
/// 公开类型 2-好友可见 1-公开 0-不公开
/// </summary>
public enum OpenStatusWithFriend
{
/// <summary>
/// 不公开
/// </summary>
Close = ,
/// <summary>
/// 公开
/// </summary>
Open = ,
/// <summary>
/// 好友可见
/// </summary>
Friend =
}
PHP中没有枚举类型,用Array来模拟表示:
public class testInfo
{
//公开类型
public static $OpenStatusWithFriend = array (
//不公开
'Close' => 0,
//公开
'Open' => 1,
//好友可见
'Friend'=>2
);
}
PHP访问:
$openType = testInfo::$OpenStatusWithFriend['Close'];