我想使用数据数据表添加行,我可以这样做
var table = $('#mytable').DataTable();
table.add.row(['first column', 'second column', 'three column', 'etc']);
Run Code Online (Sandbox Code Playgroud)
我需要的是这样的东西(TR和TD标签中的一些属性)
<tr id="someID">
<td>first column</td>
<td>second column</td>
<td>three column</td>
<td id="otherID">etc</td>
</tr>
Run Code Online (Sandbox Code Playgroud)
我如何用数据表做到这一点?
我基本上尝试过下面的mode_rewrite规则.它最后使用斜杠,但是我想让它工作,无论它是否有一个尾部斜杠.基本上我希望它像这样,因为有些人认为它是正常的,最后有一个斜线而其他人不这样做,因此我希望它能够工作,无论它是否存在.
RewriteRule ^signup/register(.[^/]*) /signup/register.php [NC]
Run Code Online (Sandbox Code Playgroud)
基本上它会工作,http://localhost/signup/register/但如果我从最后删除/它会给出404错误.
我想要paypal cURL登录,所以我需要auth值.我尝试使用此python代码从html源获取auth值
import requests
import lxml.html
import StringIO
from xml.etree.ElementTree import ElementTree
r = requests.get("https://paypal.com/cgi-bin/webscr?cmd=_login-run")
login_page = r.text.encode('utf-8') #printing html source
html = lxml.html.fromstring(login_page) #printing <Element html at 0x7f19cb242e$
auth = html.xpath('//input[@name="auth"]') #printing [<InputElement 7fb0971e9f1$
print auth
Run Code Online (Sandbox Code Playgroud)
但是上面的代码打印了这个[<InputElement 7fb0971e9f18 name='auth' type='hidden'>],那么我如何通过解码获得auth值- - .?输入部分看起来像这样
<input name="auth" type="hidden" value="ADPifNsidn-P0G6WmiMMeJbjEhnhIvZCNg7Fk11NUxc0DyYWzrH-xk5ydV.85WCzy">
Run Code Online (Sandbox Code Playgroud)
非常感谢你.
我想在成功登录贝宝后打印仪表板 html 源代码,这是我的完整代码
import requests
import lxml.html
# Get Auth & Login URL
get_login = requests.get('https://paypal.com/cgi-bin/webscr?cmd=_login-run')
get_login_response = get_login.text.encode('utf-8') #printing html source
get_login_html = lxml.html.fromstring(get_login_response) #printing <Element html at 0x7f19cb242ec0>
auth = get_login_html.xpath("//input[@name='auth']/@value") #printing [<InputElement 7fb0971e9f18 name='auth' type='hidden'>]
login_url = get_login_html.xpath("//form[@name='login_form']/@action")
# Post Login
payload = {
'login_cmd':'',
'login_params':'',
'login_email':'websec@spam4.me',
'login_password':'jancok666',
'auth':auth[0],
'submit.x':'Log In',
'form_charset':'UTF-8',
'browser_name':'Firefox',
'browser_version':'18',
'browser_version_full':'18.0'
}
post_login = requests.post(login_url[0], data=payload)
post_login_response = post_login.text.encode('utf-8')
print post_login_response
Run Code Online (Sandbox Code Playgroud)
但我得到的是像这样的验证码挑战的 html 源代码
......... <h1 class="headerText">Security Challenge</h1><p>Type the characters you see in …Run Code Online (Sandbox Code Playgroud) 我有这个验证请求
<?php
namespace App\Http\Requests;
use App\Http\Requests\Request;
class CreateUserRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required|email|unique:users',
'password' => 'required|confirmed|min:6',
'full_name' => 'required',
'address' => 'required',
'phone' => 'required|numeric',
'family_name' => 'required',
'family_address' => 'required',
'family_phone' => …Run Code Online (Sandbox Code Playgroud) 通常,我在使用网站(非 API)时会在会话内保存临时数据/数组。
今天我想用 Laravel API 做同样的事情(在会话中保存临时数据/数组)。
这是我的路线。
Route::middleware(['auth:api', 'isMember'])->group(function () {
Route::get('createSession', function (){
$a = Session::put('example', 'this is example session.');
return "session created";
});
Route::get('getSession', function () {
return Session::get('example');
});
});
Run Code Online (Sandbox Code Playgroud)
当我访问/api/createSession它时返回session created,但是当我访问/api/getSession它时什么也不返回。
那么如何在 API 中使用会话呢?
我认为为什么这不起作用,因为 API 使用基于令牌的身份验证而不是基于会话的身份验证,请参阅config/auth.php身份验证防护部分。
如果在 API 内部使用会话被认为是不好的做法,那么您对在 API 内部保存临时数据/数组以进行共享托管有何建议?
到目前为止我所尝试的是保存数据/数组,Storage::disk(local)但我认为这不是最佳实践。
提前致谢。
PS:我将使用Session来存储有关Cart的临时数据
我undefined variable $jenis_mobil完全上$q->where('name', $jenis_mobil->name)
$jenis_mobil = Car_class::find($request->jenis_mobil);
$dari_kota = City::find($request->dari_kota);
$vehicles = Vehicle::whereHas('car', function($q){
$q->whereHas('car_class', function($q){
$q->where('name', $jenis_mobil->name);
});
})
->whereHas('partner', function($q) {
$q->whereHas('kota_pool', function($q){
$q->where('name', $dari_kota->name);
});
})
->where('year', $request->tahun_mobil)
->get();
Run Code Online (Sandbox Code Playgroud)
我的代码有问题吗?我认为是因为$jenis_mobil没有传递给whereHas
这是我的JS
var rentalkika = angular.module('rentalkika', ['ngRoute']);
rentalkika.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl : 'pages/main.html'
})
.when('/sewa_mobil', {
templateUrl : 'pages/sewa_mobil.html',
controller : 'FilterController'
})
.when('/contact', {
templateUrl : 'pages/contact.html',
controller : 'ContactController'
})
.when('/register', {
templateUrl : 'pages/register.html'
});
});
rentalkika.controller('ContactController', function ($scope, $http) {
var config = {
headers: { 'X-Parse-Application-Id' : 'secret' }
};
$http.get('http://128.199.249.233:1337/parse/classes/vehicle', config).then(function (response){
console.log(response.data.results);
}, function (error) {
console.log(response);
});
});
Run Code Online (Sandbox Code Playgroud)
这是我的 contact.html
<div>
tes about html
</div>
Run Code Online (Sandbox Code Playgroud)
当我去localhost:3000/#/contact检查网络部分中的chrome时,它会在http://128.199.249.233:1337/parse/classes/vehicle第一次返回 …
条款表:
Term_taxonomy表:
我的学期模型:
public function TermTaxonomy(){
return $this->hasOne('TermTaxonomy');
}
Run Code Online (Sandbox Code Playgroud)
我的TermTaxonomy模型:
public function Term(){
return $this->belongsTo('Term');
}
Run Code Online (Sandbox Code Playgroud)
我的类别控制器:
public function update($id){
echo "$id"; // echo success
echo $data['name']; // it should update name field in term table
echo $data['slug']; // it should update slug field in term table
echo $data['TermTaxonomy']['description']; // it should update description field in termtaxonomy table
}
Run Code Online (Sandbox Code Playgroud)
如何更新一对一关系?也许与push()
谢谢,对不起,我是新来的laravel。
我有多步骤表格。每个步骤都有其自己的验证,每个步骤都有一个“下一步”按钮。
我想检查每当单击下一步按钮时,表单是否通过验证,如果验证失败,请阻止进行下一步。
这是我的表格
<form method="post">
<div id="step1" v-show="step == 1">
<div class="form-group" :class="{'has-error': errors.has('startDate') }">
<label for="startDate">Start Date</label>
<input type="text" name="startDate" class="form-control" id="startDate" v-validate="'required'">
<span v-show="errors.has('startDate')" class="text-danger">@{{ errors.first('startDate') }}</span>
</div>
<div class="form-group" :class="{'has-error': errors.has('adDuration') }">
<label for="">Ad Duration</label>
<select class="form-control" name="adDuration" v-on:change="total" v-model="adDetailOrder.unit" v-validate="'required'">
<option v-for="adDuration in adDurations" :value="adDuration.unit">@{{ adDuration.text }}</option>
</select>
<span v-show="errors.has('adDuration')" class="text-danger">@{{ errors.first('adDuration') }}</span>
</div>
</div>
<div id="step2" v-show="step == 2">
//input form and v-validate goes here
</div>
<div id="step3" v-show="step == 3">
//input form and v-validate …Run Code Online (Sandbox Code Playgroud) laravel ×3
paypal ×2
php ×2
python ×2
.htaccess ×1
angularjs ×1
class ×1
datatables ×1
friendly-url ×1
laravel-4 ×1
laravel-5 ×1
mod-rewrite ×1
vue.js ×1
xpath ×1