我想将拖动图像向左拖动时将拖动图像颜色的边框更改为红色,如果向右拖动则将蓝色更改为蓝色。不是不是在拖动之后,而是在拖动时。这可能吗?我说的是在拖动时更改DragShadowBuilder图像。我有以下代码:
drop.setOnDragListener(new View.OnDragListener() {
@Override
public boolean onDrag(View v, DragEvent event) {
Float y1 = event.getX();
Float x1 = event.getY();
switch (event.getAction()) {
case DragEvent.ACTION_DRAG_STARTED:
// Do nothing
break;
case DragEvent.ACTION_DRAG_ENTERED:
x1 = event.getX();
y1 = event.getY();
break;
case DragEvent.ACTION_DRAG_EXITED:
Log.d("msg", "Action is DragEvent.ACTION_DRAG_EXITED");
cView.setVisibility(View.VISIBLE);
break;
case DragEvent.ACTION_DRAG_LOCATION:
Float x2 = event.getX();
Float y2 = event.getY();
if (x2 > x1) {
cView.setBorderColor(Integer.parseInt("2E4172", 16) + 0xFF000000);
cView.setShadowColor(Integer.parseInt("4F628E", 16) + 0xFF000000);
} else {
cView.setBorderColor(Integer.parseInt("AA3939", 16) + 0xFF000000);
cView.setShadowColor(Integer.parseInt("D46A6A", 16) + 0xFF000000); …Run Code Online (Sandbox Code Playgroud) 我有这个 nginx 虚拟主机配置:
server {
listen 8081;
server_name blocked_server;
root /home/gian/blocked_server;
access_log off;
error_log off;
index index.php index.html index.htm index.nginx-debian.html;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ / {
try_files $uri $uri /index.php;
}
}
Run Code Online (Sandbox Code Playgroud)
它将所有 url 重定向到 index.php,除非 url 以 .php 扩展名结尾。
例如,这有效: http://localhost/somethingthatdontexist
但这会返回 404 并且不会重定向到index.php http://localhost/somethingthatdontexist.php
如何将不存在的 .php 扩展名的 url 重定向到 index.php?
我只是不知道如何在 php 上执行 shell 命令。它必须假设回显 mogrify 的参数,但它总是返回 false。我怎样才能在 MacBook Pro Yosemite 上做到这一点?我已经尝试编辑所有用户的读/写/执行权限,但仍然没有运气..已经尝试在网上研究这方面的内容,但无法得到答案。
我的代码是:
<?php
echo shell_exec("/opt/ImageMagick/bin/mogrify");
?>
Run Code Online (Sandbox Code Playgroud) 目前我调试我的Java代码如下:
public void sign_in(View view) {
String json = "";
// The Username & Password
final EditText em = (EditText) findViewById(R.id.Username);
String email = (String) em.getText().toString();
final EditText pw = (EditText) findViewById(R.id.Password);
String password = (String) pw.getText().toString();
// -----------------------
JSONObject jsonObject = new JSONObject();
try {
HttpResponse response;
jsonObject.accumulate("email", email);
jsonObject.accumulate("password", password);
json = jsonObject.toString();
URL url = new URL("http://cloudspecinc.herokuapp.com/api/user/login/");
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url.toURI());
httpPost.setEntity(new StringEntity(json, "UTF-8"));
httpPost.setHeader("Content-Type", "application/json");
httpPost.setHeader("Accept-Encoding", "application/json");
httpPost.setHeader("Accept-Language", "en-US");
response …Run Code Online (Sandbox Code Playgroud)