我安装了wordpress:
example.com
Run Code Online (Sandbox Code Playgroud)
和laravel / public目录(可从api.example.com访问)
example.com/api
Run Code Online (Sandbox Code Playgroud)
如何访问一个laravel路线说/play
从example.com/play
目前我有这个example.com/play/play显示正确的laravel路线,但我需要它上升一个级别.
在/ home/public_html/play中设置 index.php
require __DIR__.'/../../laravel/bootstrap/autoload.php';
$app = require_once __DIR__.'/../../laravel/bootstrap/app.php';
Run Code Online (Sandbox Code Playgroud)
这正确地指向了/home/laravel例如
那么路线文件是
Route::group(['prefix' => 'play'], function () {
Route::get('/', ['as'=>'/', 'uses'=>'Controller@play']);
});
Run Code Online (Sandbox Code Playgroud)
我已经添加RewriteCond %{REQUEST_URI} !^/(play/.*)$到根.htaccess所以wordpress不会接管.
最后这就是我遇到问题的地方:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /play/index.php [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)
位于 /home/public_html/play
那么我如何在/ play目录中展示laravel路线?这可以通过重写来实现吗?我可以将参数传递给laravel以告诉它以root身份开始/播放吗?
使用Laravel 5+和Vagrant.
我用selenium运行:
java -jar vendor/se/selenium-server-standalone/bin/selenium-server-standalone.jar -Dwebdriver.firefox.bin="/usr/bin/firefox"
Run Code Online (Sandbox Code Playgroud)
使用无头显示器:
sudo Xvfb :10 -ac
Run Code Online (Sandbox Code Playgroud)
但是,当我运行代码时:
./vendor/bin/codecept run selenium --steps
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
[Facebook\WebDriver\Exception\UnknownServerException] 45000 ms后无法在端口7055上连接到主机127.0.0.1.Firefox控制台输出:错误:GDK_BACKEND与可用显示不匹配
我对我应该使用的服务器和端口感到困惑.目前我访问的网站通过http://localhost:8000
外面的流浪汉.
我$url = 'http://localhost:4444/wd/hub'在里面观察api\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php
由于错误输出:
127.0.0.1在端口7055上.
使用Selenium和chrome webdriver进行PayPal结账测试.
我尝试过使用另一个域名localhost和127.0.0.1
重要的是要注意我在Vagrant机器(宅基地)内运行
也可以手动运行测试.我认为这个问题是一个环境变量
PAYMENT_SANDBOX_PAYPAL_URL=http://localhost:8000/checkout/,但是从我理解的情况来看,这与使用webdriver运行自动化测试时应该没有区别.
这是流浪者和我的主人的网络问题吗?我怎么诊断这个?
我理解这对于上面提到的设置是一个非常具体的问题,但我认为像我这样的其他新的selenium用户会发现它很有用,特别是在使用代码和laravel时.
也许它与白名单ip有关?这是当前命令.
java -jar vendor/se/selenium-server-standalone/bin/selenium-server-standalonjar -Dwebdriver.chrome.bin="/usr/bin/google-chrome" -Dwebdriver.chrome.driver="vendor/bin/chromedriver" -Dwebdriver.chrome.options="--whitelisted-ips=173.0.82.77,127.0.0.1"
Run Code Online (Sandbox Code Playgroud) 测试时:
从我的网站结帐商品时,需要模拟确认...以便我们可以继续处理订单。哪里可以进行测试..
我如何将好的代码换成模拟?例如:
$gateway = Omnipay::create('paypal');
$response = $gateway->purchase($request['params'])->send();
if ($response->isSuccessful()) { ... etc ...
Run Code Online (Sandbox Code Playgroud)
这怎么可能?
虽然我创建了测试,但我在模拟领域的知识是基础的
我一直得到的回应dd($finalResponse);是:
RestResponse {#298 ?
#statusCode: 400
#request: RestCompletePurchaseRequest {#300 ?}
#data: array:4 [?
"name" => "PAYMENT_NOT_APPROVED_FOR_EXECUTION"
"message" => "Payer has not approved payment"
"information_link" => "https://developer.paypal.com/webapps/developer/docs/api/#PAYMENT_NOT_APPROVED_FOR_EXECUTION"
"debug_id" => "5471589613718"
]
}
Run Code Online (Sandbox Code Playgroud)
这是代码.
$gateway = Omnipay::create('PayPal_Rest');
// Initialise the gateway
$gateway->initialize(array(
'clientId' => env('PAYMENT_SANDBOX_PAYPAL_CLIENTID'),
'secret' => env('PAYMENT_SANDBOX_PAYPAL_SECRET'),
'testMode' => true, // Or false when you are ready for live transactions
));
// Do an authorisation transaction on the gateway
$transaction = $gateway->authorize(array(
'returnUrl'=> env('PAYMENT_SANDBOX_PAYPAL_URL'),
'cancelUrl' => 'http://localhost:8000/cancel',
'amount' => …Run Code Online (Sandbox Code Playgroud) 是否想知道其他人如何实现以下目标?
表格:
teams
teams_users (pivot many teams, many users)
users
Run Code Online (Sandbox Code Playgroud)
我正在努力实现的目标
$teams->user->where('user_id', $id)->get();
Run Code Online (Sandbox Code Playgroud)
但是我必须运行一个循环,并在团队模型上创建另一个方法来摘录(id,name)
// foreach ($teams as $team) {
// # code...
// dump($team->getUserIdsAttribute());
// }
Run Code Online (Sandbox Code Playgroud)
你知道更好的方法吗?