php associative array multidimensions

时间:2015-09-05 07:15:16

标签: php html

我有超过3d关联数组,我想经常访问它们但它只是不工作所以请给出这个问题的解决方案:

收到错误:生成数组到字符串转换

#<!-- BEGAIN SINGLE TESTIMONIAL SLIDE1 -->
$satisfied = array(
    "team-1.jpg" => array(
        "Alin Brown" => array(
            'CEO' => "Message of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable."
        )
    ),
    "team-2.jpg" => array(
        "Jon Smith" => array(
            'CEO' => "Message of Lorem Ipsum available, but the majority have suffered alteration in some form."
        )
    ),
    "team-4.jpg" => array(
        "Jon Doe" => array(
            'Manager' => "Message of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable."
        )
    )
);

foreach ($satisfied as $sat => $val) {
    echo"<li>";
    echo"<div class='media testi_media'>";
    echo"<a class='media-left testi_img' href='#'>
    <img src='img/$sat' alt='img'/></a>";
    foreach ($val as $val1 => $val2) {
        echo "<div class='media-body'>
        <h4 class='media-heading'>$val1</h4>";
        echo "<span>$val2</span>";                      
        echo "</div>";
        echo "</div>";
        foreach ($val2 as $val3) {
            echo"<div class='testi_content'>";
            echo"<p>$val3</p>";
            echo"</div>";}
        }
        echo"</li>";
    }
}

1 个答案:

答案 0 :(得分:1)

MainActivity

public class MainActivity extends Activity {
private static final String SOAP_ACTION = "WSDL_TARGET_NAMESPACE + METHOD";
    
    private static final String OPERATION_NAME = "LoginStatus";// your webservice web method name
    
    private static final String WSDL_TARGET_NAMESPACE = "Check_Activity";
    
    private static final String SOAP_ADDRESS = "http://192.168.1.5:80/LoginService.asmx";
	private TextView textView;
	EditText userId, pass, cat;
	String userId_str, pass_str, cat_str;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		
		if (android.os.Build.VERSION.SDK_INT > 9) {
    		StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    		StrictMode.setThreadPolicy(policy);
    	}
		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		textView = (TextView) findViewById(R.id.test);
		
		
		
	}	
		
			public void RUN(View v){
		        
				 SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,     OPERATION_NAME);
                 PropertyInfo propertyInfo1 = new PropertyInfo();
                 propertyInfo1.type = PropertyInfo.STRING_CLASS;
                 propertyInfo1.name = "userId_str";
                 
                 PropertyInfo propertyInfo2 = new PropertyInfo();
                 propertyInfo2.type = PropertyInfo.STRING_CLASS;
                 propertyInfo2.name = "pass_str";
                 
                 PropertyInfo propertyInfo3 = new PropertyInfo();
                 propertyInfo3.type = PropertyInfo.STRING_CLASS;
                 propertyInfo3.name = "cat_str";
                 
                 userId = (EditText) findViewById(R.id.editText1);
         		 pass = (EditText) findViewById(R.id.editText2);
         		 cat = (EditText) findViewById(R.id.editText3);
                 
         		 userId_str=userId.getText().toString();
         		 pass_str=pass.getText().toString();
         		 cat_str=cat.getText().toString();
                 
         		//request.addProperty(propertyInfo1, userId_str);
         		 request.addPropertyIfValue(propertyInfo1, userId_str);
         		 request.addPropertyIfValue(propertyInfo1, userId_str);
         		 request.addPropertyIfValue(propertyInfo1, userId_str);
                         
                         SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                         SoapEnvelope.VER11);
                         envelope.dotNet = true;
                         
                         envelope.setOutputSoapObject(request);
                         
                         HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
                         
                         try  {                    
                         httpTransport.call(SOAP_ACTION, envelope);                    
                         Object response = envelope.getResponse();                    
                         textView.setText(response.toString());                    
                         }  catch (Exception exception)   {
                        	 textView.setText(exception.toString()+"  Or Invalid Entry");                    
                         }
				
	        }
}