Linux+nginx使用if判断问题
最近遇到这样的一个问题:我在本地的操作项目环境是Wamp的,然后上传到服务空间是Linux+nginx的。在本地运行和在Wamp环境运行时,以下这个功能是完全没问题的,如图:
但是在Linux+nginx却出现了这样的情况:
实现功能的代码都是一样的,这部分代码的截图如下:
$properties_gj = get_goods_properties_gj($goods_id); // 获得高级定制商品的规格和属性
//var_dump($properties_gj);
$spe = array();
foreach ($properties_gj['spe'] as $v){
if($v['name'] == '加字'){
$spe[0] = $v;
}
if($v['name'] == '外观材质'){
$spe[1] = $v;
}
if($v['name'] == '内里材质'){
$spe[2] = $v;
}
}
//echo "
"; <br> //var_dump($spe);exit; <br> 附加:打印$properties_gj的结果 <br> array(3) { <br> ["pro"]=> <br> array(0) { <br> } <br> ["spe"]=> <br> array(3) { <br> [2]=> <br> array(3) { <br> ["attr_type"]=> <br> string(1) "1" <br> ["name"]=> <br> string(6) "加字" <br> ["values"]=> <br> array(1) { <br> [0]=> <br> array(6) { <br> ["label"]=> <br> string(12) "雕刻文字" <br> ["price"]=> <br> string(3) "200" <br> ["imgs"]=> <br> string(50) "./images/attr/c249e9ab5fb4df62753e3ce483ca2296.png" <br> ["times"]=> <br> string(1) "5" <br> ["format_price"]=> <br> string(9) "¥200.00" <br> ["id"]=> <br> string(3) "265" <br> } <br> } <br> } <br> [3]=> <br> array(3) { <br> ["attr_type"]=> <br> string(1) "1" <br> ["name"]=> <br> string(12) "外观材质" <br> ["values"]=> <br> array(1) { <br> [0]=> <br> array(6) { <br> ["label"]=> <br> string(21) "可定制任何木纹" <br> ["price"]=> <br> string(3) "500" <br> ["imgs"]=> <br> string(50) "./images/attr/8d0a35a4d338ae4acdfbe650d84026bc.png" <br> ["times"]=> <br> string(2) "15" <br> ["format_price"]=> <br> string(9) "¥500.00" <br> ["id"]=> <br> string(3) "266" <br> } <br> } <br> } <br> [4]=> <br> array(3) { <br> ["attr_type"]=> <br> string(1) "1" <br> ["name"]=> <br> string(12) "内里材质" <br> ["values"]=> <br> array(1) { <br> [0]=> <br> array(6) { <br> ["label"]=> <br> string(18) "此款不可更换" <br> ["price"]=> <br> string(0) "" <br> ["imgs"]=> <br> string(0) "" <br> ["times"]=> <br> string(1) "0" <br> ["format_price"]=> <br> string(7) "¥0.00" <br> ["id"]=> <br> string(3) "267" <br> } <br> } <br> } <br> } <br> ["lnk"]=> <br> array(0) { <br> } <br> } <br> <br> 在Wamp环境下打印$spe是有值的,但是在Linux+nginx下,打印出来是空的,怎么也进入不了if判断,如果把if判断去掉 $spe[0] = $v;$spe[1] = $v;$spe[2] = $v;(或者把if条件里面的“==”改成“=”),只获取到 的情况。对Linux+nginx,会不会配置有关,如果不该配置,有没有解决的方法,谢谢指点一下! <p> </p> <br> <h2 id="回复讨论-解决方案">回复讨论(解决方案)</h2> <p class="sougouAnswer"> 你把$properties_gj 和$goods_id 打印一下看看 </p>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Following its high-profile acquisition by Facebook in 2012, Instagram adopted two sets of APIs for third-party use. These are the Instagram Graph API and the Instagram Basic Display API.As a developer building an app that requires information from a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio
