zoukankan      html  css  js  c++  java
  • 利用360壁纸接口,制作精美壁纸站

       借鉴孟坤的360壁纸接口,确实挺好用的,制作了壁纸站,演示:http://www.sdfymj.com/so/wallpaper/

    <?php
    
    $cid = getParam('cid', '360new');
    
    switch($cid)
    {
        case '360new':  // 360壁纸 新图片
            $start = getParam('start', 0);
            $count = getParam('count', 10);
    		echojson (file_get_contents("http://wp.birdpaper.com.cn/intf/newestList?pageno={$start}&count={$count}"));
        break;
        case '360tags':
    	   echojson (file_get_contents("http://wp.birdpaper.com.cn/intf/getCategory"));
    	   
        break;
        
        case 'bing':
            $start = getParam('start', -1);
            $count = getParam('count', 8);
            echojson (file_get_contents("http://cn.bing.com/HPImageArchive.aspx?format=js&idx={$start}&n={$count}"));
        break;
    	
    	case '360search':
    	    $content = getParam('content', '');
            $start = getParam('start', 0);
            $count = getParam('count', 10);
            echojson (file_get_contents("http://wp.birdpaper.com.cn/intf/search?content={$content}&pageno={$start}&count={$count}"));
        break;
        
        default:
            $start = getParam('start', 0);
            $count = getParam('count', 10);
    	   echojson (file_get_contents("http://wp.birdpaper.com.cn/intf/GetListByCategory?cids={$cid}&pageno={$start}&count={$count}"));
            
    }
    
    
    /**
     * 获取GET或POST过来的参数
     * @param $key 键值
     * @param $default 默认值
     * @return 获取到的内容(没有则为默认值)
     */
    function getParam($key,$default='')
    {
        return trim($key && is_string($key) ? (isset($_POST[$key]) ? $_POST[$key] : (isset($_GET[$key]) ? $_GET[$key] : $default)) : $default);
    }
    
    /**
     * 输出一个json或jsonp格式的内容
     * @param $data 数组内容
     */
    function echojson($data)    //json和jsonp通用
    {
        // $callback = getParam('callback');
        // if($callback != "") //输出jsonp格式
        // {
        //     echo $callback."(".$data.")";
        // }
        // else
        // {
            echo $data;
        // }
    }
    

      

  • 相关阅读:
    js复习(一)
    Webform(文件上传)
    Webform(分页与组合查询配合使用)
    Webform(分页、组合查询)
    webform(内置对象)
    Webform(内置对象-Response与Redirect、QueryString传值、Repeater删改)
    Webform(Repeater控件)
    MDI窗体容器 权限设置
    进程和线程
    WinForm三级联动
  • 原文地址:https://www.cnblogs.com/68xi/p/13380797.html
Copyright © 2011-2022 走看看