Javascript IF语句 - javascript

            
        

    

嗨,我有这段代码可以正常工作,并将两个日历显示为一个日历。我还有一个php变量$login_session,其中包含登录电子邮件地址的用户。

关于如何显示[email protected]日历的任何想法

(伪代码)

IF $login_session == "[email protected]" 

ELSE $login_session == "[email protected]" 

显示en.uk#[email protected]日历?可以做到吗?

任何帮助表示赞赏

googleCalendarApiKey: 'AIzaSyDcnW6WejpTOCffshGDDb4neIrXVUA1EAE',
    eventSources: [
    {
        googleCalendarId: '[email protected]',
    },
    {
    googleCalendarId: 'en.uk#[email protected]'
    }
        ],

参考方案

<?php
if ($login_session == "[email protected]") {
    $calendar = "[email protected]";
} else {
    $calendar = 'en.uk#[email protected]';
}
?>
googleCalendarApiKey: 'AIzaSyDcnW6WejpTOCffshGDDb4neIrXVUA1EAE',
    eventSources: [
    {
        googleCalendarId: '<?php echo $calendar; ?>',
    }
],

45码