<?php
/**
 * @link         http://www.openzc.cn/
 * @author       hexipeng | e-mail:2017412656@qq.com
 * @copyright    Copyright (c) 2020, Openzc, Inc.
 * @license      http://www.openzc.cn/license.txt
 */
class varModel{
	function Run(&$atts, &$refObj, &$fields){
		
		$attlist = "name=,type=,field=";	
		FillAtts($atts,$attlist);
		FillFields($atts,$fields,$refObj);
		extract($atts, EXTR_OVERWRITE);

		if(!isset($GLOBALS[$name])){
			if(strstr($name,"_GET")){if(!isset($$name)){return false;}}
			echo "Error: The variable name '\$".$name."' does not exist!";
			return false;
		}
		if(is_array($GLOBALS[$name])){
			$result=$GLOBALS[$name];
			if($type=='son' && $field){
				$result=$fields[$field];
			}
			return $result;
		}else{
			echo $GLOBALS[$name];
		}
	}
}
