php如何将表单数组显示为ul li

时间:2017-05-22 20:02:03

标签: php

我有一个这样的数组:

FATAL EXCEPTION: main
                                                                Process: es.iesnervion.qa, PID: 5133
                                                                java.lang.RuntimeException: Unable to start activity ComponentInfo{es.iesnervion.qa/es.iesnervion.qa.ui.View.LoginActivity}: android.view.InflateException: Binary XML file line #101: Binary XML file line #101: Error inflating class com.google.android.gms.common.SignInButton
                                                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3253)
                                                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
                                                                    at android.app.ActivityThread.access$1100(ActivityThread.java:221)
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
                                                                    at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                    at android.os.Looper.loop(Looper.java:158)
                                                                    at android.app.ActivityThread.main(ActivityThread.java:7224)
                                                                    at java.lang.reflect.Method.invoke(Native Method)
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
                                                                 Caused by: android.view.InflateException: Binary XML file line #101: Binary XML file line #101: Error inflating class com.google.android.gms.common.SignInButton
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
                                                                    at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288)
                                                                    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:143)
                                                                    at es.iesnervion.qa.ui.View.LoginActivity.onCreate(LoginActivity.java:116)
                                                                    at android.app.Activity.performCreate(Activity.java:6876)
                                                                    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
                                                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)
                                                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
                                                                    at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
                                                                    at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                    at android.os.Looper.loop(Looper.java:158) 
                                                                    at android.app.ActivityThread.main(ActivityThread.java:7224) 
                                                                    at java.lang.reflect.Method.invoke(Native Method) 
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                                                                 Caused by: android.view.InflateException: Binary XML file line #101: Error inflating class com.google.android.gms.common.SignInButton
                                                                    at android.view.LayoutInflater.createView(LayoutInflater.java:657)
                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:847)
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:855)
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:855)
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:527)
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
                                                                    at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288) 
                                                                    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:143) 
                                                                    at es.iesnervion.qa.ui.View.LoginActivity.onCreate(LoginActivity.java:116) 
                                                                    at android.app.Activity.performCreate(Activity.java:6876) 
                                                                    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
                                                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) 
                                                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
                                                                    at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
                                                                    at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                    at android.os.Looper.loop(Looper.java:158) 
                                                                    at android.app.ActivityThread.main(ActivityThread.java:7224) 
                                                                    at java.lang.reflect.Method.invoke(Native Method) 
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                                                                 Caused by: java.lang.reflect.InvocationTargetException
                                                                    at java.lang.reflect.Constructor.newInstance(Native Method)
                                                                    at android.view.LayoutInflater.createView(LayoutInflater.java:631)
                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776) 
                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:847) 
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:855) 
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:855) 
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:527) 
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
                                                                    at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288) 
                                                                    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:143) 
                                                                    at es.iesnervion.qa.ui.View.LoginActivity.onCreate(LoginActivity.java:116) 
                                                                    at android.app.Activity.performCreate(Activity.java:6876) 
                                                                    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
                                                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) 
                                                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
                                                                    at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
                                                                    at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                    at android.os.Looper.loop(Looper.java:158) 
                                                                    at android.app.ActivityThread.main(ActivityThread.java:7224) 
                                                                    at java.lang.reflect.Method.invoke(Native Method) 
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                                                                 Caused by: java.lang.NoSuchMethodError: No static method zzac(Ljava/lang/Object;)Lcom/google/android/gms/dynamic/zzd; in class Lcom/google/android/gms/dynamic/zze; or its super classes (declaration of 'com.google.android.gms.dynamic.zze' appears in /data/app/es.iesnervion.qa-1/base.apk)
                                                                    at com.google.android.gms.common.internal.zzae.zzc(Unknown Source)
                                                                    at com.google.android.gms.common.internal.zzae.zzb(Unknown Source)
                                                                    at com.google.android.gms.common.SignInButton.zzbw(Unknown Source)
                                                                    at com.google.android.gms.common.SignInButton.setStyle(Unknown Source)
                                                                    at com.google.android.gms.common.SignInButton.<init>(Unknown Source)
                                                                    at com.google.android.gms.common.SignInButton.<init>(Unknown Source)
                                                                    at java.lang.reflect.Constructor.newInstance(Native Method) 
                                                                    at android.view.LayoutInflater.createView(LayoutInflater.java:631) 
                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776) 
                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:847) 
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:855) 
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:855) 
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:527) 
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
                                                                    at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288) 
                                                                    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:143) 
                                                                    at es.iesnervion.qa.ui.View.LoginActivity.onCreate(LoginActivity.java:116) 
                                                                    at android.app.Activity.performCreate(Activity.java:6876) 
                                                                    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
                                                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) 
                                                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
                                                                    at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
                                                                    at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                    at android.os.Looper.loop(Looper.java:158) 
                                                                    at android.app.ActivityThread.main(ActivityThread.java:7224) 
                                                                    at java.lang.reflect.Method.invoke(Native Method) 
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 

如何显示如下信息:

$files = array(
    array(
        'name' => 'Detailed Brief - www.xyz.com.pdf',
        'size' => '1.4MB',
    ),
    array(
        'name' => 'Pure WordPress theme.zip',
        'size' => '735.9KB',
    ),
    array(
        'name' => 'Logotype.jpg',
        'size' => '94.7KB',
    ),
);

有什么想法吗?我一直在ul - li Detailed Brief...- pdf(1.4mb) Pure Wordpress... - zip(735.kb) Logotype.jpg-(94,7kb) 尝试,但它无效。

2 个答案:

答案 0 :(得分:1)

很简单:

<ul>
    <?php foreach ($files as $key => $file): ?>
        <li><?php echo $file['name'] . ' - ' . $file['size'] ?></li>
    <?php endforeach ?>
</ul>

答案 1 :(得分:0)

另一个答案并非完全您正在寻找什么。对于循环的每次迭代,您需要文件名,文件扩展名和文件大小:

package passwordValidator;

import java.util.Scanner;

public class Main {
    /**
     * @author felipe mello.
     */

    private static Scanner scanner = new Scanner(System.in);

     /*
     * Create a password validator(from an input string) via TDD
     * The validator should return true if
     *  The Password is at least 8 characters long
     *  The Password contains uppercase Letters(atLeastOne)
     *  The Password contains digits(at least one)
     *  The Password contains symbols(at least one)
     */


    public static void main(String[] args) {
        System.out.println("Please enter a password");
        String password = scanner.nextLine();   

        checkPassword(password);
    }
    /**
     * 
     * @param checkPassword the method check password is validating the input from the the user and check if it matches the password requirements
     * @return
     */
    public static boolean checkPassword(String password){
        boolean upperCase = !password.equals(password.toLowerCase()); //check if the input has a lower case letter
        boolean lowerCase = !password.equals(password.toUpperCase()); //check if the input has a CAPITAL case letter
        boolean isAtLeast8 = password.length()>=8;                    //check if the input is greater than 8 characters
        boolean hasSpecial = !password.matches("[A-Za-z0-9]*");       // check if the input has a special characters
        boolean hasNumber = !password.matches(".*\\d+.*");            //check if the input contains a digit
        if(!isAtLeast8){
            System.out.println("Your Password is not big enough\n please enter a password with minimun of 8 characters");
            return true;
        }else if(!upperCase){
            System.out.println("Password must contain at least one UPPERCASE letter");
            return true;
        }else if(!lowerCase){
            System.out.println("Password must contain at least one lower case letter");
            return true;
        }else if(!hasSpecial){
            System.out.println("Password must contain a special character");
            return true;
        }else if(hasNumber){
            System.out.println("Password must contain at least one number");
            return true;
        }else{
            System.out.println("Your password: "+password+", sucessfully match the requirements");
            return true;
        }

    }
}