小编miX*_*iXo的帖子

Htaccess重写删除尾部斜杠

Htaccess以某种方式自动地在URL的末尾删除所有尾部斜杠并且只保留一个.

例如,http:// localhost/api/param1 ///成为http:// localhost/api/param1 /

你能否告诉我为什么会发生这种情况以及如何摆脱这种情况?(.*)应该匹配一切吗?但事实并非如此.就像我说的,如果我去的http://本地主机/ API /参数1 ///$_GET['url']应该是param1///,但它是param1/.

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
Run Code Online (Sandbox Code Playgroud)

php .htaccess

5
推荐指数
1
解决办法
117
查看次数

Android 对 SD 卡的写访问

我正在尝试写入外部辅助存储(sd 卡),但看起来我没有权限。

根据安卓:

辅助外部存储不得由应用程序写入,除非在合成权限允许的特定于包的目录中。

所以这行不通:

try {
    String sdCard = System.getenv("SECONDARY_STORAGE");
    FileWriter writer = new FileWriter(new File(sdCard, "test.txt"));
    writer.write("a test");
    writer.flush();
    writer.close();
} catch (IOException e) {
    Log.d(e.toString());
    //java.io.FileNotFoundException: /storage/extSdCard/test.txt: open failed: EACCES (Permission denied) 
}
Run Code Online (Sandbox Code Playgroud)

我在 AndroidManifest.xml 中有权限 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

并且Environment.getExternalStorageDirectory()无法工作,因为我试图写入可移动 SD 卡而不是手机内存。

那么,如果应用程序应该被禁止写入二级存储,那么文件管理器之类的应用程序如何写入 SD 卡呢?

java android android-external-storage

2
推荐指数
1
解决办法
1474
查看次数

准备好的声明没有问号占位符

没有问号占位符的预备声明仍然安全吗?

例:

String username = "userename from EditText";
String password = "password from EditText";

PreparedStatement statement = _con.prepareStatement("SELECT * FROM users WHERE username = '"+username+"' AND password = '"+password+"';");
ResultSet rs = statement.executeQuery();
Run Code Online (Sandbox Code Playgroud)

java jdbc

1
推荐指数
1
解决办法
823
查看次数

PHP代码保护库

php中有许多代码保护库,但是它们需要安装额外的php模块,这是我买不起的,因为应用程序将运行在我不拥有的服务器上.所以我想我可以做自己的.

我想做的事:

$source = file_get_contents("encryptedPhpFile.php");
$source = decrypt($source, "mySecretKey");
//$source now contains decrypted source code which needs to be included

//I cant use eval($source); because that code also contains 
//html/css/opening and closing php tags ... which eval() does
//not know how to render

//I cant write the source into temporary file and then include
//that file because as soon as I write decrypted source to a disk,
//it is exposed and it can be copyed 
Run Code Online (Sandbox Code Playgroud)

我能做什么?有什么建议?

php

-2
推荐指数
2
解决办法
97
查看次数

标签 统计

java ×2

php ×2

.htaccess ×1

android ×1

android-external-storage ×1

jdbc ×1