小编kyo*_*kyo的帖子

直接从公用文件夹加载HTML文件,如Laravel中的View

我正在使用Laravel.我想把自己的婚礼邀请放在一起.我的公共文件夹中有一个文件夹,它有样式和脚本.

我想知道我是否可以指向该文件夹,而不是将所有内容复制并粘贴到新的刀片文件中.


路线

Route::get('/wedding', 'WeddingController@index');


WeddingController

<?php namespace App\Http\Controllers;

class WeddingController extends Controller {


    public function index()
    {
        return view('wedding.index');
    }

}
Run Code Online (Sandbox Code Playgroud)

我想知道我是否可以指向我的索引函数来加载index.html我的/ public文件夹中的一个文件夹.

我们是否必须.bladeapp/resources/views目录中加载文件?

任何有关这方面的帮助/建议将不胜感激.

php view laravel blade laravel-5

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

自定义用户身份验证基于API调用的响应

描述:

我现在一直在使用Laravel进行一系列项目.在Laravel中实现用户身份验证很简单.现在,我正在处理的结构有点不同 - 我没有本地databaseusers表或表.我必须进行API调用以查询我需要的内容.


我试过了

public function postSignIn(){

    $username     = strtolower(Input::get('username'));
    $password_api = VSE::user('password',$username); // abc <-----
    $password     = Input::get('password'); // abc <-----


    if ( $password == $password_api ) {
        //Log user in
        $auth = Auth::attempt(); // Stuck here <----
    }

    if ($auth) {
      return Redirect::to('/dashboard')->with('success', 'Hi '. $username .' ! You have been successfully logged in.');
    }
    else {
      return Redirect::to('/')->with('error', 'Username/Password Wrong')->withInput(Request::except('password'))->with('username', $username);
    }
  }
Run Code Online (Sandbox Code Playgroud)

更新

shell_execVSE班上使用一个简单的命令连接到API

public static function …
Run Code Online (Sandbox Code Playgroud)

php authentication laravel laravel-5.1

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

如何在div中间(水平)创建边框?

我有一行像这样的对象/元素:

在此输入图像描述

我想创建一条线,并将它放在我的所有对象后面,如果我的div ,则放在 中心.

这是我希望做的:

在此输入图像描述

要在div的顶部,右侧,底部,左侧或周围创建边框非常简单,但在div的中间却非常难.我一直在努力研究这个,但到目前为止我看不到任何好的.

任何CSS专家都想展示你的CSS技能?

Fiddle

css border css3 less

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

调用未定义的函数App\Http\Controllers\[函数名称]

在我的控制器中,我创建了一个函数 getFactorial

public static function getFactorial($num)
{
    $fact = 1;
    for($i = 1; $i <= $num ;$i++)
        $fact = $fact * $i;
    return $fact;
}
Run Code Online (Sandbox Code Playgroud)

然后,我就这样使用它

public function codingPuzzleProcess()
{

    $word     = strtoupper(Input::get('word'));
    $length   = strlen($word);
    $max_value = ($length * 26);
    $characters = str_split($word);

    $num = 1 ;
    $index = 1;

    sort($characters);

    foreach ( $characters as $character) {
        $num += getFactorial($index) * $index;
        $index ++;
    }

    return Redirect::to('/coding-puzzle')
        ->with('word', $word )
        ->with('num', $num )
        ->with('success','Submit successfully!');

}
Run Code Online (Sandbox Code Playgroud)

出于某种原因,我不断收到此错误

Call to …

php laravel laravel-5

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

获取lat,lng基于地址

我有

一组用户地址

array:5 [?
  0 => array:2 [?
    "name" => " Admin"
    "address" => "111 Park AveFloor 4 New York, NY"
  ]
  1 => array:2 [?
    "name" => "User A"
    "address" => "12 Main Street Cambridge, MA"
  ]
  2 => array:2 [?
    "name" => "Apple  HQ"
    "address" => "1 Infinite Loop Cupertino, California"
  ]
  3 => array:2 [?
    "name" => "Google MA"
    "address" => "355 Main St Cambridge, MA"
  ]
  4 => array:2 [?
    "name" => "site HQ"
    "address" => …
Run Code Online (Sandbox Code Playgroud)

javascript php jquery google-maps-api-3 google-maps-markers

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

在Laravel的pgsql上的仙人掌

描述

我有一个laravel应用程序,我正在尝试将其与Cacti集成:是一个完整的网络图形解决方案,旨在利用RRDTool的数据存储和图形功能的强大功能.


脚步

我已下载它,并将其放在我的public/目录中.

现在,当我去找我的时候 http://localhost:8888/cacti/


我有

第一次尝试

致命:无法连接到'localhost'上的MySQL服务器.请确保在'include/config.php'中指定了有效的MySQL数据库名称


然后,我打开了'include/config.php'.由于我的目标是尝试连接它pgsql而不是mysql,所以我这是我当前的设置

$database_type = "pgsql";
$database_default = 'cacti';
$database_hostname = 'localhost';
$database_username = 'postgres';
$database_password = '';
$database_port = '5432';
$database_ssl = false;
Run Code Online (Sandbox Code Playgroud)

一旦我点击保存,刷新页面 http://localhost:8888/cacti/

第二次尝试

现在,我得到:The localhost page isn’t working:(

在此输入图像描述


数据库

我已经在cacti运行端口的localhost上创建了一个数据库5432.

在此输入图像描述


任何提示/建议将非常感谢!

php mysql cacti laravel psql

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

requests.exceptions.SSLError

我有fiddle.py4行

import requests

url = "https://randomuser.me/api/"
locations = requests.get(url,verify=False).json()

print locations
Run Code Online (Sandbox Code Playgroud)

当我跑的时候,我一直在努力

requests.exceptions.SSLError:[SSL:SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3警报握手失败(_ssl.c:590)


试试#1

verify=False

运行代码,相同错误.


试试#2

sudo pip install --upgrade requests

运行代码,相同错误.


试试#3

sudo pip install --upgrade pip

sudo pip install requests[security]

运行代码Diff Error.

requests.exceptions.SSLError :("坏握手:错误([('SSL例程','SSL23_GET_SERVER_HELLO','sslv3警报握手失败')],)",)


细节

Python 2.7.10
OpenSSL 0.9.8zh 14 Jan 2016
Mac OS X 10.11.6
Run Code Online (Sandbox Code Playgroud)

如何进行调试?


我现在正在接受任何建议.

任何提示/建议/帮助将非常感谢!

python macos pyopenssl python-requests

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

强制Sublime文本编辑器使用4个空格进行缩进

我一直在寻找我的代码保持显示2个空格而不是4个空格的原因.

在底部也显示为Spaces : 4.

在此输入图像描述


<!DOCTYPE html>
<html lang="en">

<head>

  @include('layouts.fe.meta')
  @include('layouts.fe.links')
  <link rel="stylesheet" type="text/css" href="{{ elixir('assets/fe/css/all.css') }}"/>

  <link href="https://fonts.googleapis.com/css?family=Roboto:400,500" rel="stylesheet">
  <link rel="stylesheet" href="/css/hover-min.css">
  <link rel="stylesheet" href="/css/magnific-popup.css">
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

  <style type="text/css">
  body{
    font-family: 'Roboto', sans-serif !important;
  }

  #back_home {
    position: absolute;
    left: 10px;
    top: 5px;
  }
</style>

</head>

<body>

  <a href="/#portfolio" style="color:white;" class="btn btn-sm btn-success" id="back_home">Back Home</a>

  <section id="page-portfolio" class="page-portfolio">
    <div class="container">
      <div class="row text-center" style="padding: 0px !important; margin: 0px !important;">

        <header class="section-header">
          <h2 class="section-title"><span>Portfolio</span></h2>
          <div class="spacer"></div>
          <p …
Run Code Online (Sandbox Code Playgroud)

javascript sublimetext laravel sublimetext3 laravel-blade

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

iPhone不支持任何应用程序的架构.您可以将arm64e体系结构添加到应用程序的体系结构构建设置中

我在Xcode 9上.我刚买了我的iPhone XS Max.我试着将我的应用安装到它上面.

我不断得到

iPhone不支持任何应用程序的架构.您可以将iPhone的arm64e架构添加到应用程序的架构构建设置中.

在此输入图像描述

构建设置

在此输入图像描述


问题

如何进行并防止此错误?


我现在对任何建议持开放态度.

任何提示/建议/帮助将非常感谢!

xcode ios xcode9

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

如何获取 UTC 和 iPhone 之间的时区偏移 - Swift 4.2?

我使用的是Swift 4.2。我正在努力获取 UTC 和 iPhone 上的时间之间的偏移时间。


我有这个代码

extension TimeZone {
    func offsetFromGMT() -> String
    {
        let localTimeZoneFormatter = DateFormatter()
        localTimeZoneFormatter.timeZone = self
        localTimeZoneFormatter.dateFormat = "Z"
        return localTimeZoneFormatter.string(from: Date())
    }
}
Run Code Online (Sandbox Code Playgroud)
func getCurrentTimeZone() -> String{
    return String (TimeZone.current.identifier)
}


var tzOffset = ""
let currentTimeZone = getCurrentTimeZone()
TimeZone.knownTimeZoneIdentifiers.forEach({ timeZoneIdentifier in
    if let timezone = TimeZone(identifier: timeZoneIdentifier)
    {
        //print("\(timezone.identifier) \(timezone.offsetFromGMT())")
    
        if(timezone.identifier == currentTimeZone){
            tzOffset = timezone.offsetFromGMT()
        }
    }
})
Run Code Online (Sandbox Code Playgroud)

结果

如果我做

print(tzOffset)
Run Code Online (Sandbox Code Playgroud)

我有

-0500
Run Code Online (Sandbox Code Playgroud)

应该是-5因为我的 currentTimeZone 是吗America/Montreal …

timezone timezone-offset swift

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