Как я устанавливаю Тип контента в Joomla?

Вы можете использовать setInterval, чтобы ограничить частоту выполнения кода, например

setInterval(function(){
    if (props.city) {
        useEffect(() => {
            fetch(`https://api.openweathermap.org/data/2.5/weather?q=${props.city}&units=metric&APPID=af081727ae6d5c4cbe2cd266b726e632`).then(results => {return results.json();}
            ).then(data => setWind(data.wind.speed))
        })
        useEffect(() => {
            fetch(`https://api.worldweatheronline.com/premium/v1/weather.ashx?key=a5bf94fc16c84928acb114156182311&q=${props.city}&num_of_days=1&tp=24&format=json`).then(results => {return results.json();}
            ).then(data => setPrecipitation(data.data.weather[0].hourly[0].chanceofrain))
        })
        useEffect(() => {
            fetch(`https://api.openweathermap.org/data/2.5/weather?q=${props.city}&units=metric&APPID=af081727ae6d5c4cbe2cd266b726e632`).then(results => {return results.json();}
            ).then(data => setPressure(data.main.pressure))
        })        
        useEffect(() => {
            fetch(`https://api.openweathermap.org/data/2.5/weather?q=${props.city}&units=metric&APPID=af081727ae6d5c4cbe2cd266b726e632`).then(results => {return results.json();}
            ).then(data => setHumidity(data.main.humidity))
        })}}, 10000);

, а затем просто настроить время для проверки того, как часто вы хотите его проверять

6
задан Eddie 1 March 2009 в 03:45
поделиться

1 ответ

Начиная с версии 1.5 Joomla имеет объект JDocument. Используйте JDocument:: setMimeEncoding () для установки типа контента.

$doc =& JFactory::getDocument();
$doc->setMimeEncoding('application/pdf');

В Вашем особом случае взгляд на JDocumentPDF может быть worthwile.

12
ответ дан 8 December 2019 в 18:43
поделиться
Другие вопросы по тегам:

Похожие вопросы: