假设我有这个数组:
$cars = array("Saab","Volvo","BMW","Toyota");
Run Code Online (Sandbox Code Playgroud)
我也有这个Foreach循环来"操纵"该数组:
foreach ($cars as $carsdata)
{
if (*this is array[0]) {
do something here
}else if (*array[1] ... array[x]){
do another thing here
}
}
Run Code Online (Sandbox Code Playgroud)
任何想法如何正确写出Foreach?谢谢.
我在2个不同的数据库上有2个表:
db1.table1
+--------------+--------------------------+
| Username | Message |
+--------------+--------------------------+
| jamesbond | I need some help |
| jamesbond | I need some help |
| jamesbond | I need some help |
| jamesbond | Mission accomplished |
+--------------+--------------------------+
Run Code Online (Sandbox Code Playgroud)
db2.table2
+--------------------------+--------------+
| Message | Status |
+--------------------------+--------------+
| I need some help | Ok |
| I need some help | Ok |
| I need some help | Bad |
+--------------------------+--------------+
Run Code Online (Sandbox Code Playgroud)
当我使用这种SQL语法'INNER JOIN'那些表时:
SELECT A.Username, A.Message
SUM(CASE WHEN …Run Code Online (Sandbox Code Playgroud) 我只是阅读了一些关于如何以编程方式操作约束数的信息,但我认为我需要使用Xcode直观地看到它.所以我决定放一个这样的UIView,看看Constraints发生了什么:

自动它将创建4个约束:

在修改数字后,我得到了所有这些的含义.我们有2个垂直空间和2个水平空间.但是让我们首先关注垂直......
从屏幕顶部测量的垂直空间之一(我认为是superview),我给出了这个数字30.和从底部测量的其他垂直空间,我给了-50.
现在,当它变成代码时,我真的不明白如何给这两个数字.据我所知,这里是如何使用代码设置约束:
NSLayoutConstraint *myConstraint =[NSLayoutConstraint
constraintWithItem:_screenView
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:_container
attribute:NSLayoutAttributeHeight
multiplier:20
constant:200];
[_screenView addConstraint: myConstraint];
Run Code Online (Sandbox Code Playgroud)
让我们假设_screenView是一个_container超级视图,并将UIView放在它上面.我有3个问题:
NSLayoutConstraint吗?[_screenView addConstraint: myConstraint];两次吗?multiplier用?因为我在故事板中没有看到这个选项.非常感谢你.
我有这个代码,它可以正常打开一个网页:
package com.example.fragmenttabs;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.app.Fragment;
public class FragmentTab2 extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragmenttab2, container, false);
String url = "http://example.com";
WebView view = (WebView)rootView.findViewById(R.id.webView2);
view.getSettings().setJavaScriptEnabled(true);
view.loadUrl(url);
return rootView;
}
}
Run Code Online (Sandbox Code Playgroud)
但不幸的是,当我点击该网页视图中的链接时,它会打开谷歌浏览器.如何禁用此行为?我想在同一个webview中打开它.未在Google Chrome中打开.谢谢.
我有这个代码:
<?php
$key = 'thisisakey';
$iv = '1234567812345678';
$plaintext = 'Hello World';
$ciphertext = openssl_encrypt($plaintext, 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $iv);
echo $ciphertext . '<br>';
$plaintext = openssl_decrypt($ciphertext, 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $iv);
echo $plaintext . '<br>';
?>
Run Code Online (Sandbox Code Playgroud)
此代码背后的想法是加密要在URL上使用的数据.所以,我期待输出哪个URL友好.我的意思是,它只包含字母数字字符.但是当我使用这个openssl_encrypt函数时,我得到了奇怪的字符,我不认为URL友好.
它产生这样的输出:
^‘-7Ⱦ®l¿ô¾áÙ
Run Code Online (Sandbox Code Playgroud)
如何生成URL友好字符openssl_encrypt?谢谢
如何拆分此字符串:
56A19E6D77828
Run Code Online (Sandbox Code Playgroud)
进入这样的格式:
56A1 9E6D 7782 8
Run Code Online (Sandbox Code Playgroud)
是否有为此构建的本机PHP函数?
我有这个round_button.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/colorPrimary"></solid>
<corners android:radius="3dp"></corners>
</shape>
</item>
</selector>
Run Code Online (Sandbox Code Playgroud)
我将那个 drawable 用于我的两个按钮:
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/Button_Register"
android:background="@drawable/round_button"
android:textColor="@color/formLabelTextColor"
android:text="@string/loginform_buttonregister" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/Button_Login"
android:background="@drawable/round_button"
android:textColor="@color/komWhite"
android:text="@string/loginform_buttonlogin" />
Run Code Online (Sandbox Code Playgroud)
我的问题是...
如何Button_Register在java中更改背景颜色?我试着用这个:
Button button_register = (Button) findViewById(R.id.Button_Register);
button_register.setBackgroundColor(R.color.formBackgroundColor);
Run Code Online (Sandbox Code Playgroud)
它删除了可绘制的形状。我只想更改该特定按钮的颜色。但是怎么样?
谢谢你。
php ×3
android ×2
encryption ×1
ios ×1
mysql ×1
objective-c ×1
spaces ×1
split ×1
webview ×1
xcode ×1