Archive for ‘ Php

13 May 2009

Otra manera de implementar tus servicios Web con Php Posted by Insane in Php | No responses

IService.php Este es la interfaz que tus clases deberian de implementar para tener un control de ellas. <?php interface IService{ function _response(); } ?> GenericJson .php En esta clase hacemos un ejemplo sencillo del uso de los servicios web. <?php require_once "Service.php"; class GenericJson implements IService{ public $_response; public $_actionName; public static $DEFAULT_ACTIONANE='default'; #---contructor public function __construct(){ global $_SERVER; global $_REQUEST; $this->_actionName = array_key_exists('action',$_REQUEST)? $_REQUEST['action'] : $this->DEFAULT_ACTIONANE; } #---default action public function default(){ return "--"; } #metodo implementado function _response(){ $action = $this->_actionName; $res= $this->$action(); return [...]

07 Oct 2008

¿ Necesitas ayuda con tu Pbbg ? Posted by Insane in Php | No responses

Has jugado alguna vez Pbbg ´s ( persistent browser-based game )  como Travian o Bitefight ? ,  yo se que sí , se tambien que “ah, eso esta bien facil” ó “estoy casi seguro que esto lo hace un cron” han pasado por tu mente. La verdad es que construir un juego basado en web [...]

Tags:, ,

30 Sep 2008

Diferencia entre dos fechas con php. Posted by Insane in Php | No responses

Les dejo el dato para calcular la diferencia de dias entre dos fechas. #Calculamos la diferencia entre hoy y el 1/septiembre/2008 $dateDiff = time() - mktime(0,0,0,1,30,2008); # dicha diferencia / segundos / minutos / horas $fullDays = floor($dateDiff/(60*60*24)); echo "$days dias de diferencia entre ambas fechas"; #Para los one-line fans. floor(( time() - mktime(0,0,0,1,30,2008))/ 86400 ); #60*60*24

Tags:, ,