小编Jon*_*jie的帖子

如何更改composer使用的PHP版本

我在互联网上做了很多研究,我发现我的问题很多,但它们并不完全是我所拥有的.我想要的是在我的机器中使用已经使用WAMP安装的另一个php版本(2 PHP version installed).我也安装了composer并使用该PHP5.6版本.我有一个需要<的新项目PHP7.0.每当我从WAMP的控制面板中选择PHP 7然后运行php -v它仍然打印PHP5.6 (CLI)...而不是PHP7.

如何在不重新安装作曲家的情况下使用PHP7?

php composer-php

19
推荐指数
5
解决办法
5万
查看次数

使用Laravel的PayPal API - 更新数据

我想要实现APIPayPal paymentLaravel 5.1.但是当我登录时PayPal (sandbox),它使用我在帐户中使用的地址,并且它使用PayPal帐户中的名称而不是我网站上的数据.那是我的问题.

我想使用我网站上的数据,因为如果我从我的网站输入发货地址(例如)并且不使用它,则没有意义.请参阅下面的代码以供参考(或者在下面评论我的一些细节).

class PaypalPaymentController extends BaseController
{

    private $_api_context;

    public function __construct(){
        $paypal_conf = \Config::get('paypal');

        $this->_api_context = new ApiContext(new OAuthTokenCredential(
            $paypal_conf['client_id'],
            $paypal_conf['secret']
        ));

        $this->_api_context->setConfig($paypal_conf['settings']);
    }

    public function payWithPaypal(Request $request){
        $payer = new Payer;
        $payer->setPaymentMethod('paypal');

        $price = 0;

        switch($request->get('amount')) {
            case '10 books':
                $price = 6200;
                break;
            case '20 books':
                $price = 12200;
                break;
            case '50 books':
                $price = 25200;
                break;
            default:
                return redirect()
                        ->route('bookstore.shipping')
                        ->with('danger', 'Please select the right …
Run Code Online (Sandbox Code Playgroud)

php paypal laravel laravel-5

10
推荐指数
1
解决办法
1619
查看次数

如何使用Laravel Eloquent获取特定的成绩数据?

我想要的:

  1. 获取grade用户在数据库中回答的内容(如果存在)并获得该答案的等级.

我有什么:

  1. 我有3表,short_answer,sa_sa_answer,short_answer_answer.
  2. 现在,short_answer表格有问题,并且每个问题都有很多答案位于short_answer_answer表格中,等级也包含在那里,问题可以有1个或更多答案.

我有什么代码:

调节器

foreach($sa_question_id as $key => $value){
   $sa = ShortAnswer::with('answers')->find($sa_question_id[$key]);
   $possible_answers = [];

   foreach($sa->answers as $possible_answer){
      $possible_answers[] .= strtolower($possible_answer->answer);
   }

   if(in_array(strtolower($sa_answer[$key]), $possible_answers)){
      $grade = ShortAnswerAnswer::where('answer', $sa_answer[$key])->get();
      echo "plus +1. Grade is: " . $grade->grade . "<br>";
   }
}
Run Code Online (Sandbox Code Playgroud)

问题是:

我只是得到答案,答案等于用户的答案.但是,如果我有两个相同的答案和不同的grade,明显不同的问题怎么办?它可以选择错误的一个.

注意: 我正在使用Laravel5.1

更新: 表结构

short_answer
- name
-question

sa_sa_answer
- short_answer_id
- …

php eloquent laravel-5

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

如何嵌入具有响应式设计的vimeo视频

我在互联网上做了很多研究,但这个问题并不完全相同.我想使用<iframe>标签嵌入来自vimeo的视频.我也试过这段代码:

.video-responsive{
    overflow:hidden;
    padding-bottom:56.25%;
    position:relative;
    height:0;
}
.video-responsive iframe{
    left:0;
    top:0;
    height:100%;
    width:100%;
    position:absolute;
}
Run Code Online (Sandbox Code Playgroud)


<div class="video-responsive">
    <iframe width="420" height="315" src="http://www.youtube.com/embed/6xisazZX9bA" frameborder="0" allowfullscreen></iframe>
</div>
Run Code Online (Sandbox Code Playgroud)

但是,如果你有一个大屏幕,它也会变大,这看起来不太好.我只是想让它缩小不超过提供的widthheight.

video vimeo responsive-design

8
推荐指数
4
解决办法
4070
查看次数

自动填写PayPal结帐不起作用

我正在尝试在我的网站上实现自动填写Paypal结账,但它没有得到我提供的国家.它只能在提交后获得数量.请参阅以下代码:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
   <div class="form-group">
        <input type="hidden" name="on0" value="Country">
        <label class="control-label">Country</label>
        <select name="os0" class="form-control">
            <option value="US">US</option>
        </select>
    </div>

    <div class="form-group">
        <input type="hidden" name="on0" value="Quantity">
        <label class="control-label">Quantity</label>
        <select name="os0" class="form-control">
            <option value="11 units">11 units $3,000.00</option>
            <option value="21 units">21 units $6,000.00</option>
            <option value="51 units">51 units $12,500.00</option>
        </select>
    </div>
</form>
Run Code Online (Sandbox Code Playgroud)

paypal autofill

7
推荐指数
0
解决办法
111
查看次数

更新我的 Homebrew 时返回错误

我正在尝试使用更新我的 Homebrew brew update,但它返回以下错误:

fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Error: Fetching /usr/local/Homebrew/Library/Taps/jonj/homebrew-old-openssl failed!
fatal: 'origin/master' is not a commit and a branch 'master' cannot …
Run Code Online (Sandbox Code Playgroud)

git homebrew

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

如何检查数组中的值是否存在于jquery/javascript中的数组中

我在互联网上搜索但是我的问题看起来并不相同.我想要的是question numberstext现场添加问题,数字应该是unique.我正在尝试检查是否array of numbers存在多个问题的数组(e.g. 8 questions),然后如果它在数组中,您可以输入该数字,只要它是not entered yet,但我的代码不起作用.我怎样才能做到这一点?请参阅下面的代码以供参考.

$(document).ready(function(){
	var try1;
  var arrayLen = $('#question\\[\\]').length;
  var numArray = [];
  var convertedArray;
  for(i = 1; i <= arrayLen; i++){
  	numArray.push(i);
  }
  
  $('#question\\[\\]').on('input', function(){
    if($.inArray($(this).val(), numArray) !== -1){
    	$('#result').html("available");
    } else{
    	$("#result").html("not available");
      return false;
    }
  });
 
});
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<input type="text" id="question[]" placeholder="multipleChoice"><br><br>
<input type="text" id="question[]" placeholder="trueFalse"><br><br>
<input type="text" id="question[]" placeholder="shortAnswer"><br><br>
<input type="text" id="question[]" placeholder="shortAnswer"><br><br>
<input type="text" id="question[]" placeholder="description"><br><br> …
Run Code Online (Sandbox Code Playgroud)

javascript arrays jquery

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

PDF格式为HTML中的空白页

我的问题是,一切都很好用我的浏览器打开PDF,直到我上传一个带有表格的pdf.然后,如果我嵌入它,它将返回一个空白页面.但其他带有表单的pdf正常打开.请参阅下面的代码:

<object data="{{ asset($test->file_path) }}" type="application/pdf" width="100%" height="100%">
    <embed src="{{ asset($test->file_path) }}" type='application/pdf'>
    <center>
        <a href="{{ route('download.test', ['id' => $test->id]) }}" class="btn btn-primary">Please click here to view</a>
    </center>
</object>
Run Code Online (Sandbox Code Playgroud)

注意:我也尝试使用<iframe>但仍然返回空白页面.

解:

选项1:

重命名我的文件已#签名.一切都应该工作正常.

选项2:

urlencode如果需要使用.

html css pdf laravel-5

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

引导日期时间选择器中未显示秒

我已经阅读了一些关于此的未解决问题,但并没有帮助我。我也阅读了moment.js文档,但不知道为什么它仍然无法正常工作。我只想添加seconds要在选择日期时间时显示的内容。请在下面查看我的代码:

$(function(){

  $('#dateTimePicker').datetimepicker({
    format: "DD/MM/YYYY hh:mm:ss A"
  });

});
Run Code Online (Sandbox Code Playgroud)
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/3.1.4/css/bootstrap-datetimepicker.min.css">


<input type="text" id="dateTimePicker" class="form-control">


<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.20.1/moment-with-locales.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/3.1.4/js/bootstrap-datetimepicker.min.js"></script>
Run Code Online (Sandbox Code Playgroud)

javascript datetimepicker twitter-bootstrap

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

Jquery动画从左到右不起作用

为什么这不起作用?这应该是从左到右,然后再从左到右依次为箭头设置动画,依此类推,但这不起作用.这是为什么?

function moveRight(){
    $('#myIcon').animate({left: "+=50"}, 1000, function(){
        $('#myIcon').animate({left: "-=50"}, 1000, moveRight)
    })
}
moveRight();
Run Code Online (Sandbox Code Playgroud)
a{
  text-decoration: none;
}
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a href="#" class="btn btn-danger btn-lg">
<span id="myIcon">?</span>&nbsp; Go Back
</a>
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery

4
推荐指数
1
解决办法
114
查看次数