小编Nil*_*ara的帖子

Laravel 5.5预期响应代码250,但代码为"530"

我知道它在StackOverFlow中是一个重复的问题(Laravel SwiftMailer:预期的响应代码250,但得到的代码为"530",消息"530-5.5.1需要验证)但是,我已经完成了所讨论的所有补救措施但仍然没有运气我正在使用我的GMail帐户使用mailtrap.io.这是.env文件和mail.php(在config下):

.ENV

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=XXXX
MAIL_PASSWORD=XXXX
MAIL_ENCRYPTION=tls
Run Code Online (Sandbox Code Playgroud)

mail.php

'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailtrap.io'),
'port' => env('MAIL_PORT', 2525),
'from' => [
        'address' => env('MAIL_FROM_ADDRESS', 'niladriXXX@XXX.com'),
        'name' => env('MAIL_FROM_NAME', 'Niladri Banerjee'),
    ],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'sendmail' => '/usr/sbin/sendmail -t -i',
'markdown' => [
        'theme' => 'default',

        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],
Run Code Online (Sandbox Code Playgroud)

从忘记密码屏幕提交有效电子邮件后,它会抛出以下错误:

预期的响应代码250但得到代码"530",消息"530 5.7.1 Authentication required"

请注意:我已经通过我的GMail"登录和安全"启用"允许安全性较低的应用程序".

寻求你的帮助.

PS:我在localhost中运行该项目.

laravel laravel-5

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

Angular 5 如何下载远程图像

在 Angular 5 中,我想从本地主机(服务器)下载图像。我已经有了带有路径的图像名称:http://localhost/projectName/uploads/3/1535352341_download.png 现在我想通过单击按钮下载。

在 Angular 的 HTML 视图中,我编写了以下代码:

<button (click)="downloadImage(car.carItem.carTitle)" type="button" class="btn btn-sm btn-info btn-action" tooltip="Download Image" placement="left" container="body"><i class="fa fa-download" aria-hidden="true"></i></button>
Run Code Online (Sandbox Code Playgroud)

在 .ts 文件中,我执行以下操作,但它会在同一选项卡中打开图像:

downloadImage(imagePath){
  window.location = imagePath;
}
Run Code Online (Sandbox Code Playgroud)

我已经浏览了Angular 4 直接下载图片的帖子,但找不到任何解决方案。所以请不要将其标记为重复。

angular angular5

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

Laravel:路线 [users.edit] 未定义

我在 Laravel 4 中创建了一个演示应用程序,以获取一些学习经验。路由.php如下:

Route::get('/', function()
{
    return View::make('hello');
});

Route::group(['prefix' => 'users', 'before' => 'auth'], function () {
Route::get('dashboard', function () {
    $layout = View::make('users.dashboard');
    $layout->title = "Dashboard";
    $layout->content = View::make('users.dashboard');       
    return $layout;
}); 
Route::get('/all/', [ 'as' => 'users.index', 'uses' => 'UserController@all']);
Route::get('/create/', [ 'as' => 'users.create', 'uses' => 'UserController@create']);
Route::get('users/login', [ 'as' => 'users.login', 'uses' => 'UserController@getLogin']);
Route::post('users/login', [ 'as' => 'users.login', 'uses' => 'UserController@postSignin']);
Route::get('users/logout', [ 'as' => 'users.logout', 'uses' => 'UserController@getLogout']);
Route::resource('/','UserController');
});

Route::controller('users', 'UserController');
Run Code Online (Sandbox Code Playgroud)

在这里,我给“用户”加上了前缀。但是,尝试在不使用正确的登录详细信息的情况下登录时,它仅显示登录页面,而不是在登录页面或仪表板上显示错误消息。 …

laravel laravel-4 laravel-routing laravel-5

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

Laravel 5.5存储base64字符串中的图像

在Laravel 5.5项目中,我已成功将信息保存到MySQL的产品表中.信息包括base64字符串,它基本上是一个图像.但是,当我在laravel项目的公共文件夹中搜索图像时,我遇到了一个问题.下面是我的ProductController.php代码

public function update(Request $request, $id)
{
    $data = $request->validate([
        'product_name' => 'required',
        'description' => 'required',
        'rating' => 'required'
    ]);

    $uploaded_image = $request->input('uploaded_image');
    $data['uploaded_image'] = $uploaded_image['value']; // base64 string
    $product = Product::findOrFail($id);
    $product->update($data);
    // the data stored into the database with no issue

    $image_base64 = base64_decode($uploaded_image['value']);
    $path = public_path();
    $success = file_put_contents($path, $image_base64.".png");

    return response()->json($data);
}
Run Code Online (Sandbox Code Playgroud)

我在下面看到以下错误:

message:"file_put_contents(C:\xampp\htdocs\laravel-api\public): failed to open stream: Permission denied"
Run Code Online (Sandbox Code Playgroud)

通过看到不同的来源,我做了以下,但没有改变.

  1. php artisan clear-compiled
  2. Icacls public/grant Everyone:F
  3. composer dump-autoload

任何的想法?

laravel laravel-5

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

Laravel 5.5 调用未定义的方法 stdClass::update()

Laravel 5.5 显示错误信息:

调用未定义的方法 stdClass::update()

对于模型中的以下代码

DB::table('adminUserLogs')
            ->where('adminUserId', $id)
            ->where('adminUserOutTime', NULL)->first()
            ->update(['adminUserOutTime' => \Carbon\Carbon::now()]);
Run Code Online (Sandbox Code Playgroud)

laravel laravel-5

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

Angular 5 ngx-toastr不显示html消息

我正在将Angular 5与ngx-toastr一起使用。我使用以下代码来呈现HTML标记以及类似消息:Hi<b>Hello</b>这是不期望的。

this.toastr.warning("Hi<b>Hello</b>");
Run Code Online (Sandbox Code Playgroud)

另外,我使用下面的代码,该代码没有控制台错误,也没有任何输出(弹出窗口):

this.toastr.show("<font color=\"red\">Hi<b>Hello</b></red></font>",null,{
disableTimeOut: true,
tapToDismiss: false,
closeButton: true,
positionClass:'bottom-left',
enableHtml:true
});
Run Code Online (Sandbox Code Playgroud)

如何在ngx-toastr中启用HTML,以便使消息看起来像:嗨,你好

angular angular5

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

关闭模态后jQuery ajax加载多次

我集成了一个引导模式并包含一个 .js 文件。js文件内容如下。.js 文件用于调用 Ajax。当我按下“加载更多”按钮时,它会触发一次 ajax 函数,这很好。但是,一旦我关闭模式并再次打开它,然后单击“加载更多”按钮,它就会触发 ajax 函数两次。如果我关闭模式并再次打开它并单击“加载更多”按钮,ajax 函数将触发三次。我的问题是:如果单击“加载更多”按钮,如何仅加载 ajax 函数一次?场景应该是:

  1. 我点击了加载更多并调用了ajax。

  2. 我关闭了模式并再次打开它。我单击了“加载更多”按钮并启动了 ajax(仅一次)。如果我再次单击“加载更多”按钮,它将再次调用 ajax 函数。

等等。

$(document).ready(function(){
   $(document).on('click','#btn-more',function(){
       var id = $(this).data('id');
       var token_csrf = $("#csrfToken").val();
       var base_path_loadata = $("input[name='base_path_loadata']").val(); 
       $("#btn-more").html("Loading....");
       $.ajax({
           url : base_path_loadata,
           method : "POST",
           data : {id:id, _token:token_csrf},
           dataType : "text",
           success : function (data)
           {
              if(data != '') 
              {
                  $('#remove-row').remove();
                  $('#load-data').append(data);
              }
              else
              {
                  $('#btn-more').html("No Data");
              }
           }
       });
   });  
});
Run Code Online (Sandbox Code Playgroud)
<div id="remove-row">
                <button id="btn-more" data-id="{{$lastId}}" class="nounderline btn-block mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" …
Run Code Online (Sandbox Code Playgroud)

ajax jquery

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

jQuery:从json响应中获取订单ID

我想获取json响应的值。我写了一个如下的Ajax函数:

$.ajax({
    url: '/v1/shopify-Ajax/ajax.php',
    method: 'post',
    data: {datalog: dataLog, variant: $('#prod').val()}
    })
    .success(function(response){
    //window.location.href = "/v1/thank-you.php";
})
Run Code Online (Sandbox Code Playgroud)

我从服务器端脚本得到如下响应:

{"order":
    {"id":303657910281,
     "email":"test20@code1.com",
     "closed_at":null,
     "created_at":"2018-03-19T01:04:58-07:00",
     "updated_at":"2018-03-19T01:04:58-07:00",
     "number":811,
     "note":null,
     "token":"9709d7c295ac1dbbaf29c2d09a9d5a9d",
     "gateway":"",
     "test":false,
     "total_price":"82.49",
     "subtotal_price":"82.49",
     "total_weight":null,
     "total_tax":"0.00",
     "taxes_included":false,
     "currency":"USD",
     "financial_status":"paid",
     "confirmed":true,          
     "total_discounts":"0.00",
     "total_line_items_price":"82.49","cart_token":null,"buyer_accepts_marketing":false,"name":"#1811","referring_site":null,"landing_site":null,"cancelled_at":null,"cancel_reason":null,"total_price_usd":"82.49","checkout_token":null,"reference":null,"user_id":null,"location_id":null,"source_identifier":null,"source_url":null,"processed_at":"2018-03-19T01:04:58-07:00","device_id":null,"phone":null,"customer_locale":null,"app_id":2306584,"browser_ip":null,"landing_site_ref":null,"order_number":1811,"discount_codes":[],"note_attributes":[],"payment_gateway_names":[""],"processing_method":"","checkout_id":null,"source_name":"2306584","fulfillment_status":null,"tax_lines":[],"tags":"","contact_email":"test20@code1.com","order_status_url":"https:\/\/checkout.shopify.com\/19258983\/orders\/9709d7c295ac1dbbaf29c2d09a9d5a9d\/authenticate?key=0XXX","line_items":[{"id":610330640393,"variant_id":2323256639497,"title":"XX","quantity":1,"price":"82.49","sku":"","variant_title":"3 XX","vendor":"X1","fulfillment_service":"manual","product_id":235965415433,"requires_shipping":false,"taxable":false,"gift_card":false,"pre_tax_price":"82.49","name":"XXXX","variant_inventory_management":null,"properties":[],"product_exists":true,"fulfillable_quantity":1,"grams":0,"total_discount":"0.00","fulfillment_status":null,"tax_lines":[]}],"shipping_lines":[],"billing_address":{"first_name":"","address1":"","phone":null,"city":"","zip":"","province":"","country":null,"last_name":"","address2":null,"company":null,"latitude":null,"longitude":null,"name":"","country_code":null,"province_code":null},"shipping_address":{"first_name":"test","address1":"6116 Beverly Dr","phone":null,"city":"Adair","zip":"50002","province":"Iowa","country":"United States","last_name":"tes","address2":null,"company":null,"latitude":null,"longitude":null,"name":"test tes","country_code":"US","province_code":"IA"},"fulfillments":[],"refunds":[],"customer":{"id":324158947337,"email":"test20@code1.com","accepts_marketing":false,"created_at":"2018-03-19T01:04:58-07:00","updated_at":"2018-03-19T01:04:58-07:00","first_name":"test","last_name":"tes","orders_count":1,"state":"disabled","total_spent":"0.00","last_order_id":303657910281,"note":null,"verified_email":true,"multipass_identifier":null,"tax_exempt":false,"phone":null,"tags":"","last_order_name":"#1811","default_address":{"id":371809157129,"customer_id":324158947337,"first_name":"test","last_name":"tes","company":null,"address1":"6116 Beverly Dr","address2":null,"city":"Adair","province":"Iowa","country":"United States","zip":"50002","phone":null,"name":"test tes","province_code":"IA","country_code":"US","country_name":"United States","default":true}}}}
Run Code Online (Sandbox Code Playgroud)

我的问题是,如何直接访问订单ID(无循环)并检查订单ID是否为null或空白。

javascript jquery

-1
推荐指数
1
解决办法
173
查看次数

Angular 5:根据输出显示状态文本

在Angular 5中,我想根据我从PHP后端(数组)收到的输出显示不同的文本.比如说,每条记录都有一个状态字段.状态可以是"已提交","已取消","请求成本"等.我想在状态中显示状态(在Angular 5中),就好像状态是'requestforcost'一样,它将打印为"Request for成本.如果状态为"已取消",则会打印为"已取消"等.我应该使用"NgIf,Else,Then"吗?目前我编写的代码如下:

<td class="font-size-md">{{item.status}}</td>
Run Code Online (Sandbox Code Playgroud)

angular angular5

-1
推荐指数
1
解决办法
131
查看次数