zoukankan      html  css  js  c++  java
  • 学习笔记6

    为方便起见,我把上一个记事分成了两部分,上面对遇到的问题进行总结,这部分对问题和非自己写的代码进行整理。
    
     <script>
    
            $(function(){
                if(<?php echo $status;?>)
                    $("input[value='1']").attr("checked",true);
                else
                    $("input[value='0']").attr("checked",true);//attr() 方法设置或返回被选元素的属性值。这是对设置开关的状态的判断
                 
                $("#site_switchSubmit").click(function(){
                    $.ajax(
                    {
                        url:"/?a=center.account.webon",
                        type:"post",
                        data:
                            {
                            flag:$("input[name='radiobutton']:checked").val()
                            },
                        dataType:"json",
                        success:function(rs)
                        {
                            alert(rs.msg);
                        }
                    })
                })
            })
     </script>
     
     
    <?php
    $tempPath=$_SITE_PATH_."web/enterpriseMod/$template/upgrade.html";
    $tempContent=file_get_contents($tempPath);
    echo($tempContent);
    ?>
     
     
    <a href="/?a=e.index&sid=1674433" target="_blank">如果您有需要点此进入查看!</a>
     
     
     $str = file_get_contents("domain/bz.sotxsports.com.txt");
        $status=1;
        if(strpos($str,"e.index")===false)
        {
            $status=0;
        }
        require_once CENTER_V. 'account/site_switch.php';
    ?>
     
     
    $path = "domain/bz.sotxsports.com.txt";
    
    $content = file_get_contents($path);
    
    $arr = json_decode($content);
    
    if($_POST['flag']) {
    
    $arr->default_url=str_replace("upgrade","index",$arr->default_url);
    
    }
    
    else {
    
    $arr->default_url=str_replace("index","upgrade",$arr->default_url);
    
    }
    
    $flag = file_put_contents($path,json_encode($arr));
    
    $rs=new stdClass();
    
    if($flag) {
    
    $rs->type="success"; $rs->msg="操作成功";
    
    } else {
    
    $rs->type="success"; $rs->msg="操作失败";
    
    }
    
    echo json_encode($rs);
    
    ?>
    

      

  • 相关阅读:
    Luogu P4727 [HNOI2009]图的同构记数
    ARC 101 E
    JSOI2019 Round2 游记
    JSOI2019 Round1(十二省联考)游记
    Technocup 2019
    Codeforces Round #533 (Div. 2)比赛总结
    学习链接
    2018.12.29-2018.1.9安师大附中集训
    关于考试
    NOIP2018提高组 游记
  • 原文地址:https://www.cnblogs.com/isuben/p/3623382.html
Copyright © 2011-2022 走看看