简体   繁体   中英

change html lang attribute dynamically with php

I have a web with two languages. I would like to set the attribute html lang to two languages, this is what i would like to do, however it does not work.

    if($domain == 'es') {
    $language = 'es';
    } else {
    $language = 'en';
    }
    ?>
    <!DOCTYPE html>
    <html lang="<?php $language ?>">

small synatx error try this

<html lang="<?php echo $language; ?>">

else use

<html lang="<?= $language; ?>">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM