本文将带您了解关于Laravel5更改public_path的新内容,同时我们还将为您解释的相关知识,另外,我们还将为您提供关于addaprivateconstructortohidetheimpli
本文将带您了解关于Laravel 5更改public_path的新内容,同时我们还将为您解释的相关知识,另外,我们还将为您提供关于add a private constructor to hide the implicit public one(Utility classes should not have public ...、Apache重写Laravel / public、How to Update the ORDS_PUBLIC_USER Password、Java中的getPath(),getAbsolutePath()和getCanonicalPath()有什么区别?的实用信息。
本文目录一览:- Laravel 5更改public_path()(laravel配置文件)
- add a private constructor to hide the implicit public one(Utility classes should not have public ...
- Apache重写Laravel / public
- How to Update the ORDS_PUBLIC_USER Password
- Java中的getPath(),getAbsolutePath()和getCanonicalPath()有什么区别?
Laravel 5更改public_path()(laravel配置文件)
我正在尝试将public
文件夹移动到其他地方。但是,我找不到修改public_path()
变量的地方。现在,“
public_path()”返回错误的文件夹路径。
在哪里可以设置变量public_path()
?
答案1
小编典典您可以使用ioc容器覆盖公共路径:
完美地为我工作的是增加public/index.php
了以下三行:
$app->bind(''path.public'', function() { return __DIR__;});
add a private constructor to hide the implicit public one(Utility classes should not have public ...
sonarlint 提示 add a private constructor to hide the implicit public one
Utility classes should not have public constructors
Utility classes, which are collections of static members, are not meant to be instantiated. Even abstract utility classes, which can be extended, should not have public constructors.
Java adds an implicit public constructor to every class which does not define at least one explicitly. Hence, at least one non-public constructor should be defined.
Noncompliant Code Example
class StringUtils { // Noncompliant
public static String concatenate(String s1, String s2) {
return s1 + s2;
}
}
Compliant Solution
class StringUtils { // Compliant
private StringUtils() {
throw new IllegalStateException("Utility class");
}
public static String concatenate(String s1, String s2) {
return s1 + s2;
}
}
Exceptions
When class contains public static void main(String[] args) method it is not considered as utility class and will be ignored by this rule.
意思是 util 类里面都是静态方法,不会去初始化这个类,所以不应该暴露一个 public 构造函数
解决方案:
定义一个 private 构造函数
Apache重写Laravel / public
对此我很抱歉,但我的根源是错误的,我不能改变这一点。 所以我必须使它在/public文件夹中工作。
我使用正常的Laravel .htaccess文件进行以下重写:
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.PHP/$1 [L]
如果我打开http://kemtime2_neu.pr.domain.de/public我将redirect到http://kemtime2_neu.pr.domain.de/public/http://kemtime2_neu.pr.domain.de/public/login
我怎样才能解决这个问题?
为什么我的子域名redirect到我的主域名?
奇怪的重写(Apache mod_rewrite)
麻烦utf-8字符&apache2重写规则
我应该放弃在Windows下部署Rails吗?
URL问题 – 传递编码的字符,如%2f和%2b
我很乐意使它从http://kemtime2_neu.pr.domain.de/工作,但得到它与http://kemtime2_neu.pr.domain.de/public/一起工作会没事的。
Apacheredirect – .htaccess – ReWriteCond
需要htaccessredirect
Apache代理 – HTTP到HTTPS
.htaccess 301将一个子域redirect到另一个,用于多个顶级域名
Angular.js路由不能在WAMP上工作
我解决了一部分。 如果我有一个.htaccess而不是/public的根
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /public/index.PHP/$1 [L]
我可以打开http://kemtime2_neu.pr.domain.de/login但图像和CSS仍然是错误的。 我需要首先检查文件是否存在于/public 。 我认为这是一个新问题 。
我使用这个帖子的3解决方案,工作正常:
http://web.archive.org/web/20130320184846/http://forums.laravel.io/viewtopic.PHP?id=1258
解决方案1 – 使用符号链接的备用安装路径。
这是首选的解决方案,通常是一个全面的好主意。 可以将应用程序安装到与public_html /无关的文件夹,然后将公用文件夹符号链接到public_html /路径。
例如:
将您的应用程序安装到/home/applications/mysite.com
想象一下你的DocumentRoot指向/var/www/vhosts/mysite.com/httpdocs
从mysite.com vhosts文件夹中删除httpdocs文件夹,然后使用符号链接连接两者:ln -s /home/applications/mysite.com/public/var/www/vhosts/mysite.com/httpdocs
解决方案2 – 使用mod_rewrite的.htaccess
此解决方案使您能够将Laravel放入公用文件夹,然后使用.htaccess文件将请求重定向到公用文件夹。 此解决方案将您的应用程序和核心系统代码放入可公开访问的文件夹 这不是我们鼓励你使用任何PHP框架的事情。
步骤1.将Laravel放置在您的文档根文件夹中。
第2步。将下面的.htaccess文件放在文档根文件夹中。
<Ifmodulee mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_URI} !^public RewriteRule ^(.*)$ public/$1 [L] </Ifmodulee>
第3步。确保你在application / config / application.PHP中手动设置你的''url''配置,否则Laravel会产生不正确的URL。 确保你的每个环境都有正确的application.url配置。 有关环境特定配置的更多信息,请参阅: http : //laravel.com/docs/install#environments
解决方案3 – 将公用文件夹合并到安装根目录中
此解决方案将您的应用程序和核心系统代码放入可公开访问的文件夹 这不是我们鼓励你使用任何PHP框架的事情。
将公共/文件夹的内容复制到你的Laravel安装文件夹,然后从你的index.PHP文件中改变这一行:
require ''../paths.PHP'';
至
require ''paths.PHP'';
请记住,任何软件包,库或其他类型的第三方代码可能没有被设计为可公开访问。
注意:同样重要的是要注意你的bundle /和public / bundles /目录现在会冲突。 使用这种方法时,您可能不想使用手工包:发布任务,而不知道捆绑包想要发布的内容。
总结
以上是小编为你收集整理的Apache重写Laravel / public全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
How to Update the ORDS_PUBLIC_USER Password
ORDS_PUBLIC_USER is the database user that’s used to create your ORDS connection pool(s). Each database configured with ORDS gets one.
When you publish a RESTful Service under HR on database X, ORDS resolves the call to the proper jdbc connection pool, then proxy connects from ORDS_PUBLIC_USER to user HR, and runs the SQL or PL/SQL.
So, now imagine what happens when you let the ORDS_PUBLIC_USER password expire? Or even worse, someone does this:
WHAT COULD GO WRONG?
Well, let’s see what could go wrong.
Let’s try to start ORDS.
RUH-ROH…
In case you can’t read that text, ORDS is having an issue with one of our connection pools.
SEVERE: The username or password for the connection pool named apex_pu, are invalid, expired, or the account is locked
So, you could unlock the account, or simply change the password BACK to what it was when ORDS was configured for the database.
But, what if you need to tell ORDS what the new password is instead?
Update the connection pool properties file.
Go into your ORDS config directory.
There will be an XML file in there for each connection pool.
Edit it with VI or notepad, and update the password field.
THIS SEEMS BAD TO ME?
Maybe you’re having a bad feeling about this. Are we really going to put the password in plain text into the config file?
Kinda.
Note the ‘!’ in front of the password string. This tells ORDS to re-write the password back out hashed when it starts up. So let’s do that, and see what happens.
Start ORDS back up.
THIS LOOKS MUCH BETTER.
OK, so ORDS is running. Let’s go back and take a look at our pool config XML file.
THAT’S NOT WHAT WE PUT IN THERE.
So the ORDS process has written the file back out.
!string = ORDS, please take this new password for the pool, then write it back such that no one else can read it, please.
@string = ORDS is using this password, but you can’t see it.
string = ORDS, this is the actual password, don’t touch it.
Remember, you need to restart ORDS for it to pick up any changes in its config files.
Java中的getPath(),getAbsolutePath()和getCanonicalPath()有什么区别?
什么之间的区别getPath()
,getAbsolutePath()
以及getCanonicalPath()
在Java中?
以及何时使用每一个?
今天关于Laravel 5更改public_path和的讲解已经结束,谢谢您的阅读,如果想了解更多关于add a private constructor to hide the implicit public one(Utility classes should not have public ...、Apache重写Laravel / public、How to Update the ORDS_PUBLIC_USER Password、Java中的getPath(),getAbsolutePath()和getCanonicalPath()有什么区别?的相关知识,请在本站搜索。
本文标签: