我想覆盖/login路由到/admin/login.在web.php我试过
//Auth::routes();
Route::get('login', ['as' => 'auth.login', 'uses' => 'App\Modules\Admin\Controllers\AdminUserController@loginAdminUser'])->name('login');
Run Code Online (Sandbox Code Playgroud)
但它仍然显示Laravel默认登录表单.我怎样才能做到这一点?
我使用的wordpress:php7.1-fpm-alpine是基于php:7.1-fpm-alpine(https://github.com/docker-library/wordpress/blob/master/php7.1/fpm-alpine/Dockerfile).
我试过了 RUN pecl install xdebug-2.5.0 && docker-php-ext-enable xdebug
这会导致构建时出错:
Step 19/19 : RUN pecl install xdebug-2.5.0 && docker-php-ext-enable xdebug
---> Running in 52c988e12cb2
downloading xdebug-2.5.0.tgz ...
Starting to download xdebug-2.5.0.tgz (267,640 bytes)
........................................................done: 267,640 bytes
76 source files, building
running: phpize
Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this …Run Code Online (Sandbox Code Playgroud) 我在互联网上做了很多研究,我发现我的问题很多,但它们并不完全是我所拥有的.我想要的是在我的机器中使用已经使用WAMP安装的另一个php版本(2 PHP version installed).我也安装了composer并使用该PHP5.6版本.我有一个需要<的新项目PHP7.0.每当我从WAMP的控制面板中选择PHP 7然后运行php -v它仍然打印PHP5.6 (CLI)...而不是PHP7.
如何在不重新安装作曲家的情况下使用PHP7?
安装后symfony/serializer我发现我的symfony.lock文件发生了变化:
diff --git a/symfony.lock b/symfony.lock
index ba6e23f..bfc391e 100644
--- a/symfony.lock
+++ b/symfony.lock
@@ -301,5 +301,8 @@
},
"symfony/asset": {
"version": "v3.3.10"
+ },
+ "symfony/serializer": {
+ "version": "v3.3.13"
}
}
Run Code Online (Sandbox Code Playgroud)
根据我的理解,它是与Symfony Flex一起引入的,但它与它有什么不同composer.lock以及为什么需要它?
laravel 5.5中控制器的命名约定是什么.它们应该是单数或复数.我看到有些人使用单数,有些人使用复数.什么是正确的形式?
我今天已从L5.5升级到L5.6(在此过程中将Symfony组件更新为v4).此外,我fideloper/proxy还将官方Laravel 5.6升级指南更新到4.0.
之后我开始收到此错误: Type error: Argument 2 passed to Symfony\Component\HttpFoundation\Request::setTrustedProxies() must be of the type integer, array given, called in /var/www/html/vendor/fideloper/proxy/src/TrustProxies.php on line 54
Symfony 4 Symfony\Component\HttpFoundation\Request::setTrustedProxies()确实期望整数(位掩码)作为第二个参数:
/**
* Sets a list of trusted proxies.
*
* You should only list the reverse proxies that you manage directly.
*
* @param array $proxies A list of trusted proxies
* @param int $trustedHeaderSet A bit field of Request::HEADER_*, to set which headers to trust from your proxies
* …Run Code Online (Sandbox Code Playgroud) 我试图在PHP中使用curl函数登录到特定页面.请检查以下代码.我在banggood.com上用我的电子邮件和密码连接,然后我想重定向到另一个私人页面,但它没有按预期工作.我没有错.我使用下面的代码重定向到此页面(https://www.banggood.com/index.php?com=account).登录后,我想访问我的订单存在的私人页面.任何帮助赞赏.
//The username or email address of the account.
define('EMAIL', 'aaa@gmail.com');
//The password of the account.
define('PASSWORD', 'mypassword');
//Set a user agent. This basically tells the server that we are using Chrome ;)
define('USER_AGENT', 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2309.372 Safari/537.36');
//Where our cookie information will be stored (needed for authentication).
define('COOKIE_FILE', 'cookie.txt');
//URL of the login form.
define('LOGIN_FORM_URL', 'https://www.banggood.com/login.html');
//Login action URL. Sometimes, this is the same URL as the login form.
define('LOGIN_ACTION_URL', 'https://www.banggood.com/login.html'); …Run Code Online (Sandbox Code Playgroud) 我在表服务器中有2列.
我有专栏ip和hostname.
我有验证:
'data.ip' => ['required', 'unique:servers,ip,'.$this->id]
Run Code Online (Sandbox Code Playgroud)
这仅适用于列ip.但是如何做到这一点hostname呢?
我想要使用列ip和hostname.验证data.ip.因为在ip和hostname列中可以重复,当用户写ip时.
我有一个表单供用户创建自定义问题.为此,用户需要介绍问题(例如:你的手机是什么?)以及字段类型(文本,长文本,复选框,选择菜单,单选按钮).如果用户选择复选框字段,选择菜单或单选按钮,则还需要引入问题的可用选项.
在数据库中,问题被插入问题和question_options表中,如:
问题表:
id question type conference_id
1 Text text 1
2 Checkbox checkbox 1
3 Radio radio_btn 1
4 select select_menu 1
5 textarea long_text 1
6 file file 1
Run Code Online (Sandbox Code Playgroud)
Registration_type_questions数据透视表:
id registration_type_id question_id required
1 1 1 1
2 1 2 1
3 1 3 0
4 1 4 0
5 1 5 0
6 1 6 1
Run Code Online (Sandbox Code Playgroud)
选项存储在questions_options表中:
id question_id value
1 2 check1
2 2 check2
3 3 rad1
4 3 rad2
5 4 select1
6 …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个PHP脚本,该脚本将调整PNG图像的大小,然后将其转换为PNG-8位模式。因此,生成的文件的大小将较小,但不会造成过多的质量损失。
编辑:引用图像的样式以更好地显示其透明度
调整大小效果完美,同时还保留了图像透明度:
问题是当我将图像转换为8位时:
imagetruecolortopalette($resizedImg, true, 255);
imagealphablending($resizedImg, false);
$transparent = imagecolorallocatealpha($resizedImg, 255, 255, 255, 127);
if(!imagefill($resizedImg, 0, 0, $transparent)) return false;
imagesavealpha($resizedImg, true);
Run Code Online (Sandbox Code Playgroud)
生成的图像是这样的,图像周围到处都是透明的:
如果我设置256种颜色而不是255种颜色:
imagetruecolortopalette($resizedImg, true, 256);
Run Code Online (Sandbox Code Playgroud)
图像将具有黑色背景:
此图像也会发生类似的结果(注意255种颜色情况下的半透明):
完整功能的代码:
function resizePng($originalPath, $xImgNew='', $yImgNew='', $newPath='')
{
if(!trim($originalPath) || !$xyOriginalPath = getimagesize("$originalPath")) return false;
list($xImg, $yImg) = $xyOriginalPath;
if(!$originalImg = imagecreatefrompng($originalPath)) return false;
if(!$resizedImg = imagecreatetruecolor($xImgNew, $yImgNew)) return false;
// preserve alpha
imagealphablending($resizedImg, false);
$transparent = imagecolorallocatealpha($resizedImg, 255, 255, 255, 127);
if(!imagefill($resizedImg, 0, 0, $transparent)) return …Run Code Online (Sandbox Code Playgroud) php ×10
laravel ×5
alpine-linux ×1
composer-php ×1
curl ×1
docker ×1
html ×1
image ×1
laravel-5 ×1
laravel-5.4 ×1
laravel-5.6 ×1
php-gd ×1
png ×1
proxy ×1
symfony ×1
symfony-flex ×1
symfony4 ×1