我正在尝试创建刀片指令,如果变量未定义,则返回变量(如果变量定义)或echo"无数据".
这是我的代码AppServiceProvider.php:
<?php
namespace App\Providers;
use Blade;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Blade::directive('p', function($ex) {
error_log(print_r($ex,true));
return '<?php $defined_vars = get_defined_vars(); if(array_key_exists(\''. $ex .'\', $defined_vars) ): echo ' . $ex . ' ; else: echo \'no data\'; endif;?>';
});
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的index.blade.php:
<p class="lead">@p($myvar)</p> …Run Code Online (Sandbox Code Playgroud) 我尝试在我的服务器上安装laravel 4(Ubuntu 12.04,nginx,php5-fpm),但安装挂起:
# composer install --verbose
Loading composer repositories with package information
Installing dependencies (including require-dev)
Run Code Online (Sandbox Code Playgroud)
- 没有错误,没有任何错误,它只是挂起而且就是这样.我尝试使用安装composer create-project laravel/laravel --prefer-dist
......结果非常相似:
Installing laravel/laravel (v4.0.9)
- Installing laravel/laravel (v4.0.9)
Loading from cache
Created project in /var/www/laravel/ex2/laravel
Loading composer repositories with package information
Installing dependencies (including require-dev)
Run Code Online (Sandbox Code Playgroud)
我找不到任何想法/解决方案.
有谁能请告诉我这是什么问题,我该如何解决?
@ antonio-carlos-ribeiro是对的,我只需要等待.但现在我又遇到了另一个问题:
安装需要30多分钟!而且很多资源(CPU和磁盘使用)......令人难以置信的资源量.以下是CPU和DISK读/写的图表:
我想这不是正常行为.有什么想法发生了什么?
谢谢!
我想将用户发送到支付门。通常它可以通过这种形式制作:
<form method="post" action="https://demo.moneta.ru/assistant.htm">
<input type="hidden" name="MNT_ID" value="12345678">
<input type="hidden" name="MNT_TRANSACTION_ID" value="000001">
<input type="hidden" name="MNT_CURRENCY_CODE" value="USD">
<input type="hidden" name="MNT_AMOUNT" value="123.45">
<input type="submit" value="Pay">
</form>
Run Code Online (Sandbox Code Playgroud)
用户按“支付”并重定向到支付门。
但我想实现这个工作流程:
问题是:如何将用户从控制器重定向到外部资源(方法应该是 POST,我需要发送一些数据,例如 MNT_ID 等(参见上面的表单示例)?
我使用 nginx、PHP 5.5.14、php-fpm、yii2、mac os。
我更改了 yii 配置以将会话存储在数据库中(postgress,用户是超级用户)。这是在我的配置中:
'session' => [
'class' => 'yii\web\DbSession',
'sessionTable' => 'session',
],
Run Code Online (Sandbox Code Playgroud)
现在,当我尝试注册新用户时,出现此错误:
Bad Request (#400)
Unable to verify your data submission
Run Code Online (Sandbox Code Playgroud)
这是日志的一部分:
10 17:25:57.434 info yii\db\Command::query SELECT "data" FROM "session" WHERE "expire">1425993957 AND "id"='cfg9sutufqchr1tdose4cack15'
/Users/pupadupa/Dev/www/mint-office-web/components/Controller.php (41)
11 17:25:57.442 info yii\web\Session::open Session started
/Users/pupadupa/Dev/www/mint-office-web/components/Controller.php (41)
12 17:25:57.450 error yii\web\HttpException:400 exception 'yii\web\BadRequestHttpException' with message '?? ??????? ????????? ?????????? ??????.' in /Users/pupadupa/Dev/www/mint-office-web/vendor/yiisoft/yii2/web/Controller.php:110
Stack trace:
#0 /Users/pupadupa/Dev/www/mint-office-web/components/Controller.php(41): yii\web\Controller->beforeAction(Object(app\controllers\user\RegistrationAction))
#1 /Users/pupadupa/Dev/www/mint-office-web/vendor/yiisoft/yii2/base/Controller.php(149): app\components\Controller->beforeAction(Object(app\controllers\user\RegistrationAction))
#2 /Users/pupadupa/Dev/www/mint-office-web/vendor/yiisoft/yii2/base/Module.php(455): yii\base\Controller->runAction('registration', Array)
#3 /Users/pupadupa/Dev/www/mint-office-web/vendor/yiisoft/yii2/web/Application.php(83): yii\base\Module->runAction('user/registrati...', …Run Code Online (Sandbox Code Playgroud) 在这里我找到了如何在 iOS 中打开设置的解决方案:How to redirect to ios settings in Safari use javascript in ios9
<input type="button" onclick="redirect()" value="Redirect">
<script>
var redirect = function() {
window.location.href = "prefs:root=Settings";
}
</script>
Run Code Online (Sandbox Code Playgroud)
但是此解决方案在我的 iPhone 6s plus 9.3.2(13F69) 上存在一些问题: - 此解决方案不适用于我的特定 iPhone,但适用于 iPhone 6s - 链接prefs:root=Safari无效
所以我有两个问题:
我安装了pynum和scipy(在osx Lion上使用python 2.7),但当我尝试构建matplotlib时
git clone https://github.com/matplotlib/matplotlib.git
cd matplotlib
python setup.py build
python setup.py install
Run Code Online (Sandbox Code Playgroud)
我有这些错误:
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATS.framework/Headers/ATSTypes.h:242: error: declaration for parameter ‘FMFontDirectoryFilter’ but no such parameter
src/_macosx.m:5912: error: expected ‘{’ at end of input
lipo: can't open input file: /var/folders/qw/pr2f7vq91b3c3ngkxrrqplm8zkv09r/T//ccAgEklo.out (No such file or directory)
error: command 'llvm-gcc-4.2' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)
有人可以告诉我这是什么问题吗?
PS起初我试图以这种方式安装它:
pip install -e git+https://github.com/matplotlib/matplotlib#egg=matplotlib-dev
Run Code Online (Sandbox Code Playgroud)
但它对我不起作用
在尝试安装quantmod包时,我从xts包中得到以下错误:
> install.packages("quantmod", repos="http://R-Forge.R-project.org", type="source")
also installing the dependencies ‘xts’, ‘TTR’
?????? URL 'http://R-Forge.R-project.org/src/contrib/xts_0.9.874.tar.gz'
Content type 'application/x-gzip' length 538182 bytes (525 KB)
==================================================
downloaded 525 KB
?????? URL 'http://R-Forge.R-project.org/src/contrib/TTR_0.22-0.1.tar.gz'
Content type 'application/x-gzip' length 276426 bytes (269 KB)
==================================================
downloaded 269 KB
?????? URL 'http://R-Forge.R-project.org/src/contrib/quantmod_0.4-3.tar.gz'
Content type 'application/x-gzip' length 123464 bytes (120 KB)
==================================================
downloaded 120 KB
* installing *source* package ‘xts’ ...
** libs
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include" -fPIC -g -O2 -c add_class.c -o add_class.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG …Run Code Online (Sandbox Code Playgroud) php ×3
composer-php ×1
csrf ×1
directive ×1
installation ×1
ios ×1
iphone ×1
javascript ×1
laravel ×1
laravel-4 ×1
laravel-5 ×1
laravel-5.2 ×1
matplotlib ×1
osx-lion ×1
payment ×1
python ×1
quantmod ×1
r ×1
r-package ×1
redirect ×1
safari ×1
session ×1
settings ×1
ubuntu-12.04 ×1
undefined ×1
xts ×1
yii ×1
yii2 ×1