数组与数据库的区别

时间:2016-07-21 04:37:44

标签: php arrays

$imeiserial123,222,333 $imeitransferserial 123,222 Array to string conversion $imei=$row["IMEI_MX"]; $imeiserial = explode(',', $imei); $imeitransfer=$row2["IMEI_MX"]; $imeitransferserial = explode(',', $imeitransfer); $a1=array($imeiserial); $a2=array($imeitransferserial); $result= array_diff_assoc($a1,$a2); 我只是想显示那两个数组之间的差异值,我使用这个代码但是它给了我错误: logger.info("After executing method : " + joinPoint.getSignature().getName()); logger.info("***************************************************************************"); } @Before("execution(* com.app.c2pc..*.*(..))") public void logBefore(JoinPoint joinPoint) { logger.info("***************************************************************************"); logger.info("Before executing method : " + joinPoint.getSignature().getName()); } @Around("execution(* com.app.c2pc..*.*(..)) && !execution(* com.app.c2pc.login.LoginController.*(..)) ") public Object logAround(ProceedingJoinPoint pjp) throws Throwable { long start = System.currentTimeMillis(); Object clazz = pjp.getTarget().getClass().getName(); String methodName = pjp.getSignature().getName(); logger.info("Entering Class " + clazz + " With Method Name " + methodName); Object[] obj = pjp.getArgs(); int i = 0; try { for (Object o : obj) { logger.info(++i + " : Parameter Name :" + (null != o ? o.toString() : "")); } } catch (Exception e) { e.printStackTrace(); } Object output = pjp.proceed(pjp.getArgs()); logger.info("Excecution Completed for method : " + methodName + " in Class : " + clazz + " with result " + output); long elapsedTime = System.currentTimeMillis() - start; logger.info("Execution time for method : " + methodName + " in Class : " + clazz + " : " + elapsedTime + " milliseconds."); return output; } @AfterThrowing(pointcut = "execution(* com.app.c2pc..*.*(..))", throwing = "error") public void logAfterThrowing(JoinPoint joinPoint, Throwable error) { logger.info("Exception thrown by method : " + joinPoint.getSignature().getName()); logger.info("Exception name : " + error); } @AfterReturning(pointcut = "execution(* com.app.c2pc..*.*(..))", returning = "result") public void logAfterReturning(JoinPoint joinPoint, Object result) { logger.info("Method : " + joinPoint.getSignature().getName() + " returned value is : " + result); } 我做错了什么?或者我需要在此功能中进行更多转换?

 string JavaScript = string.Format(@"var page = require('webpage').create();
                                                page.open('{0}',function(){{var arg = page.evaluate(
                                                function(){{return document.getElementById('form_div').innerHTML;}})
                                                console.log(arg);phantom.exit();}})", query);

                    phantomJS.RunScript(JavaScript, new string[] {
                    });

1 个答案:

答案 0 :(得分:3)

$a1 = array分配是多余的。离开吧:

$a1 = $imeiserial; // no need to put inside an array
$a2 = $imeitransferserial; // once exploded, they are already an array

使用*_assoc味道没有意义,您的密钥是数字的,只需使用array_diff

$result = array_diff($a1,$a2);