proestrela 62 Posted January 15, 2014 Boas pessoal, tou aqui com um problema no script do relogio php...Ele não me atuliza os segundos, já tentei meter a funsão header('resfresh: 1') mas assim ele atualiza-me a pagina toda de 1 em 1 segundo, e não me dá geito Queria apenas atualizar o relogio de 1 em 1 segundo e não a pagina toda :D aqui fica o codigo do relógio <?phpdate_default_timezone_set('Atlantic/Azores');echo 'Hora: ' . date('H:i:s') . ' Data: ' . PHP_EOL;$date = date('m/d/Y h:i:s', time()); // not sure what this is doing!echo date('d/m/Y', time());?> Com os melhores cumprimentos de ρэdяø™ λκλ јuηκĩэ Share this post Link to post Share on other sites
morfo2 4,680 Posted January 15, 2014 Não é possível tendo o código do relógio em PHP, terias de fazer em Ajax. Share this post Link to post Share on other sites
ThatGuyPT 457 Posted January 15, 2014 Usa Javascript/ajax. Share this post Link to post Share on other sites
proestrela 62 Posted January 15, 2014 Obrigado pelas dicas pessoal, deixo aqui o codigo para quem precisar: JavaScript colocar entre: <head></head> function ur_start(){ UR_Nu = new Date; UR_Indhold = showFilled(UR_Nu.getHours()) + ":" + showFilled(UR_Nu.getMinutes()) + ":" + showFilled(UR_Nu.getSeconds()); document.getElementById("ur").innerHTML = UR_Indhold; setTimeout("ur_start()",1000);}function showFilled(Value){ return (Value > 9) ? "" + Value : "0" + Value;} Função body: Substituir<body>por<body onload="ur_start()"> Codigo do relógio: Hora: H:M:S Data: D/M/A <?phpdate_default_timezone_set('Atlantic/Azores');echo 'Hora: ' . '<font id="ur" font-size="3" face="Trebuchet MS, Verdana, Arial, sans-serif" color="#DAD3B7"></font> ' . ' Data: ' . PHP_EOL;$date = date('m/d/Y h:i:s', time());echo date('d/m/Y', time());?> Code by ρэdяø™ λκλ јuηκĩэ 1 morfo2 reacted to this Share this post Link to post Share on other sites