小编use*_*331的帖子

Javascript - Check if cookie exists

I have trying to see if a cookie exists or not, Here is my getCookie method:

function getCookie(name)
    {
        var value = "; " + document.cookie;
        var parts = value.split("; " + name + "=");
        if (parts.length == 2) return parts.pop().split(";").shift();
    }
Run Code Online (Sandbox Code Playgroud)

and here is how I calling that method:

var cookie = getCookie("counter");
Run Code Online (Sandbox Code Playgroud)

and here is my condition I tried:

if(cookie == '')
        {
        }
        else
        {
             //Always goes here even when I clear my cookies and I know …
Run Code Online (Sandbox Code Playgroud)

javascript cookies

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

SQL - 只能在计算列上创建 UNIQUE 或 PRIMARY KEY 约束

我正在尝试使用名为 profileID 的计算列创建一个表,但是当我尝试这样做时:

CREATE TABLE Profiles 
(
    [id] [int] IDENTITY(1,1) NOT NULL,
    [profileID] AS ((id * 19379 - 62327) % 99991) NOT NULL
)
Run Code Online (Sandbox Code Playgroud)

但是,当我创建它时,出现此错误:

只能在计算列上创建 UNIQUE 或 PRIMARY KEY 约束,而 CHECK、FOREIGN KEY 和 NOT NULL 约束要求计算列被持久化。

我试图将 profileID 行调整为此

[profileID] as ( (id * 19379 - 62327) % 99991) NOT NULL UNIQUE
Run Code Online (Sandbox Code Playgroud)

但我仍然得到同样的错误。

仅供参考,我还有一个名为 id 的列,它是主键,它是唯一的并且是自动递增的。

sql sql-server

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

laravel 从模型生成数据库

我正在使用 Laravel 的一个现有项目,这个现有项目已经有模型,这是一个例子:

<?php

/**
 * Created by Reliese Model.
 * Date: Fri, 20 Apr 2018 08:56:36 +0000.
 */

namespace App\Models;

use Reliese\Database\Eloquent\Model as Eloquent;

/**
 * Class PdTcountry
 * 
 * @property int $pkcountry
 * @property string $country_code
 * @property string $country_name
 * @property string $country_localName
 * @property string $country_webCode
 * @property string $country_region
 * @property string $country_continent
 * @property float $country_latitude
 * @property float $country_longitude
 * @property string $country_surfaceArea
 * @property string $country_population
 * @property string $country_postcodeexpression
 * @property …
Run Code Online (Sandbox Code Playgroud)

php laravel laravel-artisan

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

Laravel - 编辑和更新页面

我正在使用 Laravel,我正在尝试创建一个编辑页面并在提交时调用我的更新方法,问题是我在更新时收到 404。这是我用于编辑的刀片文件,如下所示:

@extends('adminlte::page')

@section('title', 'AdminLTE')

@section('content_header')
    <h1>Professions</h1>
@stop

@section('content')
    <form method="PUT" action="/admin/professions-update/{{ $data->pkprofession }}">
        <div class="form-group">
            <label for="profession_name">Profession Name</label>
            <input type="text" name="profession_name" id="profession_name" class="form-control" value="{{$data->profession_name}}" />
        </div>
        <div class="form-group">
            <button type="submit" class="btn btn-success">Update</button>
        </div>
    </form>
@stop
Run Code Online (Sandbox Code Playgroud)

以下是我的路线:

Route::get('/admin/professions-edit/{id}', 'v1\ProfessionsController@edit');
Route::put('/admin/professions-update/{id}', 'v1\ProfessionsController@update');
Run Code Online (Sandbox Code Playgroud)

以下是被调用的方法:

public function edit($id)
    {
        $data = PdTprofession::find($id);
        return view('professions-edit', compact('data'));
    }

public function update(Request $request, $id)
    {
        $data = PdTprofession::find($id);
        return view('professions-edit', compact('data'));
    }
Run Code Online (Sandbox Code Playgroud)

为什么我会收到 404 错误,我该如何解决?

谢谢,

php laravel

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

ASP.NET-模型对象列表的API网址

目前,我正在通过jQuery进行API调用,我的问题是,是否有必要在C#中进行此调用,或者将API调用的结果转换为模型对象的ASP.NET列表?

这是我的模特

public class TeamStatsClass
{
        public int id { get; set; }
        public string name { get; set; }
        public string league { get; set; }
        public string division { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

这是我当前的ajax电话

$.ajax({
        url: "https://statsapi.web.nhl.com/api/v1/teams?sportId=1",
        success: function (data) {

            for (var team of data.teams) {

                console.log(team.name);

            }

        }
    });
Run Code Online (Sandbox Code Playgroud)

更新

我将类更改为:

public class StatsTeamsClass
    {
        public IEnumerable<Teams> teams { get; set; }
        public string copyright { get; set; }
    }
    public class Division
    {
        public int …
Run Code Online (Sandbox Code Playgroud)

c# asp.net ajax jquery curl

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

Swift 4 - 用于 Outlook 的 UIActivityViewController

我正在尝试将 UIActivityViewController 仅用于 Outlook ......我能够让我的 UIActivityViewController 像这样工作:

//Define HTML String

        var htmlString = ""

        //Add the headings to HTML String table

        htmlString += "<table border = '1' cellspacing='0' align = 'center'><tr><th>Job #</th><th>Task</th><th>Date</th></tr>"

        //For each item in punch list data array

        for i in 0..<punchListData.count {

            //If the item is selected

            if punchListData[i].cellSelected {

                //Add data to the HTML String

                htmlString += "<tr><td>" + jobList[i % jobList.count] + "</td><td align = 'center'>" + taskData[i / jobList.count] + "</td><td>" + (punchListData[i].stringData)! + …
Run Code Online (Sandbox Code Playgroud)

ios swift

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

Wordpress - 登录后受密码保护的页面白页

我有一个网站,它运行 Wordpress 5.7,我有 2 个受密码保护的页面,当我登录这些页面时,登录后出现白屏。重定向到的 URL 是:/wp-login.php?action=postpass我尝试了以下解决方案:

  • 下载一个新版本的 Wordpress 并将我网站上的 wp-login.php 替换为新版本。
  • 停用我所有的插件
  • 停用我的主题并切换到默认主题(二十九)

这些都没有奏效,有人对此问题有任何其他解决方案吗?

谢谢,

php wordpress

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

表格上的 CSS 不起作用

我有这个 HTML 表:

<table width="1100" border="1" style="text-align:center;" class="invoice">

<tr><td>&nbsp;</td><td>&nbsp;</td><td>Amount Due</td><td>Amount Enc.</td></tr>
<tr><td>&nbsp;</td><td>&nbsp;</td><td>CAD <?php echo $key['remainingbalance']; ?></td><td>&nbsp;</td></tr>

</table>
Run Code Online (Sandbox Code Playgroud)

使用这个 CSS:

table.invoice, th.invoice, td.invoice{
    border: 1px solid black;
}
Run Code Online (Sandbox Code Playgroud)

但是它不是我的表格样式,我希望表格的所有边框,td 和 tr 都是 1px 纯黑色,为什么这不起作用?

html css html-table border

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

我的URL中的PHP查询

我正在尝试编写一个代码的和平,将根据url查询中的内容更改页面的标题...

?page_id=62&action=register
Run Code Online (Sandbox Code Playgroud)

所以

if(action='register'){
  do this
}else{
  do this
}
Run Code Online (Sandbox Code Playgroud)

我怎么写这个?我以前从未处理过这个问题

php

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

iPhone上的CSS输入按钮

我在这里有这个网站http://www.taranmarlowjewelry.com/?page_id=5并且在右上角我有一个输入按钮,它在iphone上看起来很奇怪,我不知道为什么.它变成了一个像圆形/泡泡一样的按钮.

继承人输入按钮的HTML

<input type="submit" id="button" name="button" class="searchBtn" value="GO"/>
Run Code Online (Sandbox Code Playgroud)

这是CSS

.searchBtn{
    background-color:#ffa18a;
    color:#FFF;
    height:31px;
    padding:0;
    width:32px;
    border:0;
    cursor:pointer;
}
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激!

css iphone

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