小编Nit*_*Dev的帖子

Codeigniter REST API中缺少最后几个字符,json Response

我正在使用Codeigniter REST API,我有一个像这样的响应代码

$this->response(array('error' => 'Items could not be found'),403);
Run Code Online (Sandbox Code Playgroud)

它在本地机器上正常工作,但在服务器上我得到这样的输出

{"error":"Items could not be foun
Run Code Online (Sandbox Code Playgroud)

最后几个字符丢失了

实际输出应该是这样的

{"error":"Items could not be found"}
Run Code Online (Sandbox Code Playgroud)

api codeigniter

3
推荐指数
1
解决办法
1094
查看次数

如何为DirectionsService编写回调函数

我使用谷歌API v3绘制路线.我必须使用循环在地图上绘制许多路线,问题是由于函数调用是异步的,因此不会绘制某些路径.当我在函数中放置"警报"时它会起作用.所以为了解决这个问题,我写了一个'回调'功能,但它不起作用,任何想法如何纠正它?

function plotRoute() 
 {        
    var count  = jsonObject[i].length-1;
    var count1 = jsonObject[i].length;
    var route_slipt = count1/7;

    color = "#"+((1<<24)*Math.random()|0).toString(16);
    var start_latlng = new google.maps.LatLng(start,end);
    var end_latlng   = new google.maps.LatLng(jsonObject[i][count].lat,jsonObject[i][count].lng);
    var travelWaypoints = [];

for(var j in jsonObject[i]) {

    travelWaypoints.push({location: new google.maps.LatLng(jsonObject[i][j].lat,jsonObject[i][j].lng),stopover:false});
        }
                        //alert(travelWaypoints);
        var request = {
                 origin      : start_latlng, 
                 destination : end_latlng,
                 waypoints   :travelWaypoints,
                     travelMode  : google.maps.DirectionsTravelMode.DRIVING
                         };

                        putRoute(request,color);
        }
    }




function putRoute(request,color,callback)
{

            //alert('Route Plotted');
            //setTimeout(function() {alert('hello');},1250);
            var color   = color;
            var request = request;
            directionsService.route(request, function(response, …
Run Code Online (Sandbox Code Playgroud)

javascript google-maps-api-3

3
推荐指数
1
解决办法
2602
查看次数

标记与谷歌地图api中的图像和数字

我正在使用gmap ..我想在地图上放置一些标记,标记图标是动态的,我还想要一个"数字"来显示图标,这是可能的..我的代码是

function putMaker(position, title, title_dis, number, icon_img)
{
    if (!isNaN(number))
        var icon = "https://chart.googleapis.com/chart?chst=d_bubble_icon_text_small&chld=ski|bb|" + number + "|FFFFFF|000000";
    else
        var icon = null;
    var marker = new google.maps.Marker({
        position: position,
        map: map,
        icon: icon_img,
        shadow: icon,
    });
    google.maps.event.addListener(marker, 'mouseover', function() {
        infowindow.setContent(title_dis);
        infowindow.open(map, this);
    });
}
Run Code Online (Sandbox Code Playgroud)

和图标是

var icon_img = new google.maps.MarkerImage(
        "<?php echo  base_url().'timthumb.php?src='.$url.'&h=32&w=50'; ?>", //url
        new google.maps.Size(50, 32), //size
        new google.maps.Point(0, 0), //origin
        new google.maps.Point(0, 32) //anchor 
        );
Run Code Online (Sandbox Code Playgroud)

javascript php google-maps google-maps-api-3

2
推荐指数
1
解决办法
6349
查看次数

如何使用twitter api v 1.1查找用户的总推文?

嗨我想找到一个用户的总数推文,例如在这里你可以看到推文数是14 ..我有api键和所有,我只想要api电话.

我编码了这个

        $twitteruser = "Username";
        $notweets = 5000;
        $consumerkey = "#########################";
        $consumersecret = "###############################";
        $accesstoken = "####################################";
        $accesstokensecret = "$$$$$$$$$$$$$$$$$$$$$$$$$$$";

        function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) {
          $connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret);
          return $connection;
        }

        $connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);

         //
        $following = $connection->get("https://api.twitter.com/1.1/friends/ids.json?cursor=-1&screen_name=".$twitteruser."&count=".$notweets);

        echo'<pre>'; echo count($following->ids);

        $followers = $connection->get("https://api.twitter.com/1.1/followers/ids.json?cursor=-1&screen_name=".$twitteruser."&count=".$notweets);

        echo'<pre>'; echo count($followers->ids);
Run Code Online (Sandbox Code Playgroud)

我得到了follwoers计数和following数量现在我想要总计tweet数任何想法如何得到这个?

php api twitter

2
推荐指数
1
解决办法
3809
查看次数