php

Php find word in text using regular expression

拜拜、爱过 提交于 2021-02-20 03:49:39
问题 I want to find the whole words in text not a sub string. I have written following code. $str = 'its so old now.'; $a = 'so'; if (stripos($str,$a) !== false) { echo 'true'; } else { echo 'false'; } str1 = 'its so old now.'; str2 = 'it has some issue.'; I want to find word 'so' in text. it give true in both the string. But I want true in first case only because in second string 'so' contains in 'some' words. Thanks in advance 回答1: \b can be used in regex to match word boundaries. \bso\b Should

mediaplayer getduration returns 0 only in my server files

限于喜欢 提交于 2021-02-20 03:49:38
问题 i'm trying to get the audio file duration from my server using media player MediaPlayer mp = new MediaPlayer(); try { mp.reset(); mp.setDataSource("link here"); mp.prepare(); }catch (IOException e){ e.printStackTrace(); } mp.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mediaPlayer) { Log.e("time",mp.getDuration()+" .."); } }); when i put my server file link , it always return 0 but when i use another link from the web it gives me

Codeigniter 4: Cannot access the page with apache mode_rewrite

家住魔仙堡 提交于 2021-02-20 03:40:53
问题 I installed Codeigniter 4.0.0.rc3 on my local computer using Wampserver and created a 'people' controller. I can access the page using this address: http://127.0.0.1/election/index.php/people But not without 'index.php': http://127.0.0.1/election/people And this is the error: The requested URL /Projects/Web/election/public/index.php/people was not found on this server. .htaccess is in the public directory and is working because the error shows index.php in the path. This is my htaccess: #

AES GCM encryption and decryption: PHP VS C# BouncyCastle

若如初见. 提交于 2021-02-20 03:38:29
问题 I am currently working on transforming my C# AES-GCM cryptography code to PHP. However, after some research, the text encrypted by my PHP system cannot be decrypted by the C# one. I want to know if there is any difference from both codes: C# with BouncyCastle: using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Engines; using Org.BouncyCastle.Crypto.Modes; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Security; using System; using System.IO; using System.Text; /

AES GCM encryption and decryption: PHP VS C# BouncyCastle

亡梦爱人 提交于 2021-02-20 03:38:09
问题 I am currently working on transforming my C# AES-GCM cryptography code to PHP. However, after some research, the text encrypted by my PHP system cannot be decrypted by the C# one. I want to know if there is any difference from both codes: C# with BouncyCastle: using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Engines; using Org.BouncyCastle.Crypto.Modes; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Security; using System; using System.IO; using System.Text; /

Creating attendance in laravel

本小妞迷上赌 提交于 2021-02-20 02:59:05
问题 Well.. I have created a attendance system for salesman and structure of my database is users (id, name) attendances (att_id, user_id, created_at) This is the data that I have and used in creating the attendance, $final = array:2 [▼ 0 => array:3 [▼ "id" => 6 "name" => "Talha Munshi" "attendance" => array:4 [▼ 0 => array:3 [▼ "attendance" => "P" "advance" => "0" "date" => Carbon {#250 ▼ +"date": "2017-07-16 08:07:00.000000" +"timezone_type": 3 +"timezone": "Asia/Karachi" } ] 1 => array:3 [▼

PHP/MYSQL: Database Table For Email Notifications

这一生的挚爱 提交于 2021-02-20 02:52:49
问题 I want to notify users of changes on a site. Users are subscribed to different kinds of changes so I don't send all changes to all users. Here's what I am thinking: at t=0 (i.e. an if statement that checks that some table is empty) I basically have an SQL query that fetches the appropriate changes and mails to the appropriate users. I then populate a user_changes table which essentially stores what changes have been mailed to what users. Mailing is done with the php mail function Then at t>0

PHP callback: Is there an equivalent for ::class for a method of a class?

ぃ、小莉子 提交于 2021-02-20 02:52:15
问题 The bounty expires in 7 days . Answers to this question are eligible for a +50 reputation bounty. Blackbam wants to draw more attention to this question: A good solution shows a possibility to do this without passing a string but something which can be validated. If this is possible with two or three lines of codes using ReflectionClass this would totally be o.k. - I am just looking for a good way to solve this in a way such that I see an error in the IDE in case a method does not exist. In

Pass parameter to form action in HTML

不羁的心 提交于 2021-02-20 02:50:10
问题 I am trying to implement a simple file upload using the files here : http://www.sanwebe.com/2012/05/ajax-image-upload-and-resize-with-jquery-and-php I have it working and managed to change the styles etc via CSS and change the filenames etc etc. I now need to use this in an iframe and pass a variable for the filename. In my app I can use either localstorage,setItem('clientID',10) or add a parameter to the iframe url. www.xxx.com/uploads?clientID= 10. The plugin has an html file that then

WooCommerce email IDs and order status change for email notifications

落爺英雄遲暮 提交于 2021-02-20 02:15:55
问题 I am trying to add a function that will log any email that is sent through order status changes. Is there a hook I can use that is triggered right before an order notification email is sent? 回答1: Updated All the available hooks responsible for triggering email notifications are located in WC_Emails init_transactional_emails() method and are action hooks: woocommerce_low_stock , woocommerce_no_stock , woocommerce_product_on_backorder , woocommerce_order_status_pending_to_processing ,