小编Ray*_*Lin的帖子

Facebook API - 什么是"curl -F"?

来自Facebook Graph Api(https://developers.facebook.com/docs/reference/api/):

发布:您可以使用访问令牌通过向相应的连接URL发出HTTP POST请求来发布到Facebook图形.例如,您可以通过向https://graph.facebook.com/arjun/feed发出POST请求,在Arjun的墙上发布新的墙贴:

curl -F 'access_token=...' \
     -F 'message=Hello, Arjun. I like this new API.' \
     https://graph.facebook.com/arjun/feed
Run Code Online (Sandbox Code Playgroud)
  • Q1:这是一个javascript还是php?
  • Q2:我没有看到"卷曲-F"功能参考,有人可以给我看一个吗?

非常感谢〜

api curl facebook

8
推荐指数
1
解决办法
8431
查看次数

Google+登录,PHP一次性代码/服务器端流,没有"Silex/twig"

用于服务器端应用的Google+登录示例代码

  // Create a state token to prevent request forgery.
  // Store it in the session for later validation.
  $state = md5(rand());
  $app['session']->set('state', $state);
  // Set the client ID, token state, and application name in the HTML while
  // serving it.
  return $app['twig']->render('index.html', array(
      'CLIENT_ID' => CLIENT_ID,
      'STATE' => $state,
      'APPLICATION_NAME' => APPLICATION_NAME
  ));
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

问题:如何在没有silex/twig的情况下进行服务器端工作?

php google-plus

8
推荐指数
1
解决办法
1528
查看次数

Google-plus登录:代码运行两次,用户在登录后立即注销

这是一个基于示例构建的页面

<html>
<head>
  <title>Demo: Getting an email address using the Google+ Sign-in button</title>
  <style type="text/css">
  html, body { margin: 0; padding: 0; }
  .hide { display: none;}
  .show { display: block;}
  </style>
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
  <!--<script src="https://apis.google.com/js/plusone.js" type="text/javascript"></script>-->
  <script src="https://apis.google.com/js/client:plusone.js" type="text/javascript"></script>
  <script type="text/javascript">
  /*
   * Triggered when the user accepts the sign in, cancels, or closes the
   * authorization dialog.
   */
  function loginFinishedCallback(authResult) {
    if (authResult) {

       console.log('authResult : ',authResult);
      if (authResult['error'] == undefined){
        gapi.auth.setToken(authResult); // Store the …
Run Code Online (Sandbox Code Playgroud)

google-plus

7
推荐指数
1
解决办法
883
查看次数

Jquery验证,将错误消息放在现有元素中,而不是生成<label>标记

我使用Jquery验证插件来验证下面的这两个输入元素.当输入无效时,插件将在输入字段后面生成标签标记,例如:<label for="company" style="">Required !</label>

问题:如何将错误消息放在已存在<span class="help-inline">而不是生成新消息<label>

非常感谢您的帮助.

<script type="text/javascript">

 $('#signUpForm').validate({
                            debug: false,
                            rules: {company:"required",username:"required"},
                         messages: {company:"Required !",username:"Required !"}
                          })// End of validate()

</script>


<div class="control-group">
   <label class="control-label" for="company">Company Name</label>
   <div class="controls">
      <input type="text" name="company">
      <label for="company">Required !</label> // -> this line is generated by Plug-In.
      <span class="help-inline">(required)</span>
   </div>
</div>

<div class="control-group">
   <label class="control-label" for="username">User Name</label>
   <div class="controls">
      <input type="text" name="username">
      <span class="help-inline">(required)</span>
   </div>
</div>
Run Code Online (Sandbox Code Playgroud)

jquery jquery-validate

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

拖放多个选定的draggable并使用Jquery UI还原无效的draggable

使用光标(套索)绘制一个框将.item在此JSFiddle示例中选择多个.

被选中.item的人变成了拖延..slot没有.item内部的空是有效的droppable.

当您在多个droppable上放置多个draggable时,.item如果相应的droppable无效,则只有哪个鼠标处于打开状态才会恢复.

如果删除无效的 droppable,如何使每个 draggable revert ?

使用Javascript:

$(function () {
  // we are going to store the selected objects in here
  var selected = $([]),
    total = [],
    offset = {
        top: 0,
        left: 0
    };

  $(document).selectable({
    filter: ".item",
    start: function (event, ui) { //remove draggable from selection, otherwise previous selection will still be draggable. 
        $(total).draggable("destroy");
    },
    selected: function (event, ui) { // push …
Run Code Online (Sandbox Code Playgroud)

jquery jquery-ui jquery-ui-selectable jquery-ui-draggable jquery-ui-droppable

5
推荐指数
1
解决办法
3840
查看次数

Google+ JavaScript API:如何检测用户登录状态?

我已经部署了Google+登录按钮,现在我必须提供注销按钮,在此之前,我需要知道用户是否仍然已登录,然后我可以通过该按钮显示或隐藏此按钮.

我找到了这个文档:gapi.auth.checkSessionState(sessionParams,callback):https: //developers.google.com/+/web/api/javascript?hl = en #gapiauthchecksessionstatesessionparams_callback

有人可以演示如何使用它吗?

非常感谢.

google-api-client google-plus

4
推荐指数
2
解决办法
2万
查看次数

选择器中的jQuery变量

我需要$('.mk[value=x]')工作,但它确实$('.mk[value=1]')没有.请有人帮忙

<body>
<span class="mk" value="1">1</span>
<span class="mk" value="1">1</span>
<span class="mk" value="3">3</span>
<input id="update" type="button" value="1" />
</body>

<script type="text/javascript">
$('#update').click(function(){
    var x = this.value //--> x =1 
       $('.mk[value=x]').each(function(key, value) { //--> NOT WORKING !
       $('.mk[value=1]').each(function(key, value) { //--> WORKING !
       $(this).replaceWith('<span class="mk" value="2">2</span>')
       });
    })
</script>
Run Code Online (Sandbox Code Playgroud)

html jquery

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

Jquery,Javascript:推送2D数组

想创建这样的数组:

track[divID][wrapID]
Run Code Online (Sandbox Code Playgroud)

我无法使用 track[divID][wrapID] = wrapID

cos会在另一个循环中将更多内容添加到第二维,如下所示: track[divID][wrapID,wrapID2]

var track =[];
$("div").each(function() {

                        var wrapID = $(this).parent().attr('id')
                        var divID  = $(this).attr('id')

                        track[divID].push(wrapID)

                                                    });
Run Code Online (Sandbox Code Playgroud)

错误是"Uncaught TypeError:无法读取未定义的属性'push'"

我做错了什么 ?非常感谢.

javascript arrays jquery

0
推荐指数
1
解决办法
227
查看次数